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 |
|
goodsolution
Starting Member
38 Posts |
Posted - 2009-10-08 : 23:27:45
|
| Hi all, I have a little doubt on writing sql statement using a variable, Ex:declare @i set @i = '(case when q.id = 123 then 2 else q.id) '-- I am not expecting the below result select @i as id from questionGetting Result : id(case when q.id = 123 then 20000 else q.id)-- I am expecting the below resultExpected Result : id 20000How can i use the variable to achieve the Expected Result?Thanks.-Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-09 : 13:44:09
|
| not sure why you need to pass the case expression via dynamic sql. are you trying for cross tabbing the result? |
 |
|
|
|
|
|