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 |
|
MangoSkin
Starting Member
22 Posts |
Posted - 2010-07-05 : 11:02:13
|
| I am trying to use this inside a where clause(case when @approved=1 then Tbl1.BoolValue =1 else (Tbl1.BoolValue =0 or Tbl1.BoolValue is null))But get this error "Incorrect syntax near '='."How can I correct this. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-05 : 11:11:07
|
| (Tbl1.BoolValue = 1 and @approved=1) or ((@approved<>1 and (Tbl1.BoolValue =0 or Tbl1.BoolValue is null)))MadhivananFailing to plan is Planning to fail |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-05 : 11:37:10
|
Madhi meant this in WHERE clause without using CASE. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
MangoSkin
Starting Member
22 Posts |
Posted - 2010-07-05 : 11:46:54
|
quote: Originally posted by madhivanan (Tbl1.BoolValue = 1 and @approved=1) or ((@approved<>1 and (Tbl1.BoolValue =0 or Tbl1.BoolValue is null)))MadhivananFailing to plan is Planning to fail
Will this slow the query. It is running pretty slow after the new condition is added. SO I am thinking to split the query into two stored procs. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-06 : 02:16:05
|
quote: Originally posted by MangoSkin
quote: Originally posted by madhivanan (Tbl1.BoolValue = 1 and @approved=1) or ((@approved<>1 and (Tbl1.BoolValue =0 or Tbl1.BoolValue is null)))MadhivananFailing to plan is Planning to fail
Will this slow the query. It is running pretty slow after the new condition is added. SO I am thinking to split the query into two stored procs.
That would be good ideaMadhivananFailing to plan is Planning to fail |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-07-06 : 04:03:51
|
quote: Originally posted by MangoSkin I am trying to use this inside a where clause(case when @approved=1 then Tbl1.BoolValue =1 else (Tbl1.BoolValue =0 or Tbl1.BoolValue is null))But get this error "Incorrect syntax near '='."How can I correct this.
You are missing the END part for the CASE clause. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|