Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UPDATE variable number of fields
Message
De
07/04/2000 14:44:10
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
UPDATE variable number of fields
Divers
Thread ID:
00357040
Message ID:
00357040
Vues:
38
Hi all!

I have a stored proc that looks something like this:
CREATE PROCEDURE p_table_update
    @pkfield INT,
    @field1 VARCHAR(50),
    @field2 VARCHAR(50) = NULL
AS
UPDATE table SET
    field1 = @field1,
    field2 = @field2
    WHERE pkfield = @pkfield
Is there a way that if I don't send the @field2 parameter, that it gets 'ignored' in the UPDATE statement? Other than writing 2 UPDATE statements of course!

I have tried with CASE, but it looks like CASE can't be used this way! :(
Sylvain Demers
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform