Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a variable in the FROM clause of a SELECT
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00877124
Message ID:
00877133
Vues:
16
Any time ...

>Hi Sergey,
>
>Okay, that'll work. Didn't think about using that approach.
>
>Once again, you're quick and right on top of things. Many thanks...
>
>
>>T-SQL doesn't support variables in table names. You can use dynamic SQL instead.
DECLARE @sql varchar(4000)
>>SET @sql = 'update @chvTableName SET ClientID = ClientID + ' + CAST(@insClientOffset AS varchar(16)) +
>>', QuoteID        = QuoteID  + ' + CAST(@insQuoteOffset AS varchar(16)) +
>>', MasterClientID = MasterClientID + ' + CAST(@insMasterClientOffset AS varchar(16))
>>
>>EXECUTE (@sql)
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform