select * from tablename where ckeyfieldname = @cwhereIf 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.
>declare @cwhere as varchar(1000) >declare @csql as varchar(1000) > >set @cwhere = 'XXXXXXXX' > >set @csql = 'select * from tablename where ckeyfieldname = @cwhere' >exec (@csql) >>