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 |
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-12-21 : 01:43:25
|
| Hi,I am using this query to execute but it didn't declare @AccountID numeric(3,0)set @AccountID = 101select * from AccountTestWHERE AccountID IN (CASE WHEN @AccountID = 101 THEN (100,101) ELSE @AccountID END)I m getting error likeMsg 102, Level 15, State 1, Line 9Incorrect syntax near ','.Pls help me outT.I.A |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-21 : 02:04:20
|
SELECT * FROM AccountTestWHERE (@AccountID = 101 AND AccountID IN (100, 101))OR @AccountID = AccountID E 12°55'05.25"N 56°04'39.16" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-21 : 02:07:38
|
| You cant put a variable as a value inside INUse like thisdeclare @AccountID numeric(3,0)set @AccountID = 101select * from AccountTestWHERE (@AccountID = 101 AND AccountID IN (100,101))OR (AccountID =@AccountID) |
 |
|
|
under2811
Constraint Violating Yak Guru
366 Posts |
Posted - 2007-12-21 : 02:11:08
|
| Thanks u both :)Gr8 Help :) |
 |
|
|
|
|
|