Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variable Scope
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Divers
Thread ID:
00663609
Message ID:
00663615
Vues:
23
You can run select like this w/o EXEC
select * from tablename where ckeyfieldname = @cwhere
If it just an example, than
set @csql = 'select * from tablename where ckeyfieldname = ''' + @cwhere +''''
Note, that single quote in the string literal has to be doubled.


>I know there has to be a way to do this... how do I make the following work?
>
>
>declare @cwhere as varchar(1000)
>declare @csql as varchar(1000)
>
>set @cwhere = 'XXXXXXXX'
>
>set @csql = 'select * from tablename where ckeyfieldname = @cwhere'
>exec (@csql)
>
>
>I am losing me @cwhere variable when I evaluate the @csql string. BTW, this is a simple example of what I am trying to do only for example.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform