if i have a dynamic sql query something like this
set @strsql = 'select @somevar = somecolumn from ' + @tablename + 'where condition '
exec @strsql
it does not populate the @somevar variable. I have also tried
set @strsql = 'select ' + @somevar ' + = somecolumn from ' + @tablename + 'where condition '
exec @strsql
How can i get the desired column value into this variable??
Any help will be appreciated.
Depp
Start Free Trial