Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
yaman
Posting Yak Master
213 Posts |
Posted - 2008-07-31 : 02:56:24
|
| Sir I have a dynamic query and i want to store a data which is come from dynamic query into another variable .It is possible set @col2=N'(SELECT '+@columnName+' FROM tbl_RTIDesignation WHERE '+@columnName+'=@desigName)';if query execute some query return 'DESIGNATION NAME'and i want to store a that name into another variable Sir how can i Yaman |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-31 : 05:18:57
|
quote: Originally posted by yaman Sir I have a dynamic query and i want to store a data which is come from dynamic query into another variable .It is possible set @col2=N'(SELECT '+@columnName+' FROM tbl_RTIDesignation WHERE '+@columnName+'=@desigName)';if query execute some query return 'DESIGNATION NAME'and i want to store a that name into another variable Sir how can i Yaman
i think you need to use sp_executesql here. have a look at syntax and usage in books online. |
 |
|
|
|
|
|