Viewing 3 posts - 1 through 3 (of 3 total)
Common table expression can be used in select /insert /update statement for one time only, as next statement of defination only.
November 2, 2009 at 2:52 am
#1073723
with small correction...
declare @lstr varchar(200)
declare @word table (tableName varchar (50))
set @lstr = 'select top 1 name from sysobjects'
insert @word
exec(@lstr)
select * from @word
🙂
November 2, 2009 at 12:10 am
#1073671
If you can not use CTE you can replace the code by temp tables or table variables.:-)
November 1, 2009 at 11:22 pm
#1073667