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 |
nsah382
Starting Member
2 Posts |
Posted - 2011-11-14 : 09:33:00
|
I am trying to write a query. But I am getting a syntax error near 'or'. I must be doing something wrong. declare @VALUATOR_TYPE varchar(5)set @VALUATOR_TYPE ='v,i'select * from dbo.Reportswhere report_flags like (case @VALUATOR_TYPEwhen 'v' then '%v%'when 't' then '%t%'when 'i' then '%i%'when 'v,i' then '%v%' or '%i%'when 'i,t' then '%i%' or '%t%'end)Please let me know the correct syntax.Thanks and Regards,Neel |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-11-14 : 09:53:34
|
case @VALUATOR_TYPEwhen 'v' then '%v%'when 't' then '%t%'when 'i' then '%i%'when 'v,i' then '%[vi]%'when 'i,t' then '%[it]%'end==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
nsah382
Starting Member
2 Posts |
Posted - 2011-11-14 : 11:02:07
|
Thanks a ton..!!! it worked..quote: Originally posted by nigelrivett case @VALUATOR_TYPEwhen 'v' then '%v%'when 't' then '%t%'when 'i' then '%i%'when 'v,i' then '%[vi]%'when 'i,t' then '%[it]%'end==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
Thanks and Regards,Neel |
 |
|
|
|
|