Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append value to a field in SP
Message
 
 
À
24/01/2020 06:51:37
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
01672711
Message ID:
01672730
Vues:
51
Hi Dan,

But I thought that IIF() only works with VFP; and for SQL Server stored procedure I need a CASE.
Did I miss something?
Thanks,

>Hey Dmitry,
>
>Instead of CASE statement you might try the IIF() syntax so the code is a little simpler.
>
>>Hi,
>>
>>I have a long stored procedure which updates a record in a table. There is a long UPDATE command in the SP, as follows (simplified):
>>
>>UPDATE mytable set field1 = COALESCE(@field1Val,field1), field2 = COALESCE(@field2Val,field2), 
>>			field3 = COALESCE(@field3Val,field3) where PK_VALUE = @PkValue
>>
>>
>>The above works but overrides the value in the field. For example, say I want to append the field "field2" with the value in the variable @field2Val, instead of overriding it.
>>
>>How do I change the above segment of the SP?
>>
>>TIA
>>
>>UPDATE. I figured that I can use the CASE THEN ELSE END in the UPDATE expression. All set.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform