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 |
ironmonkey
Starting Member
8 Posts |
Posted - 2010-07-06 : 10:17:09
|
Not sure why i'm getting this error for the following queryIncorrect syntax near the keyword 'in'.case @NumActualMonthswhen @NumActualMonths in (10,11) then month(t.Level0_level_alias + ' 23 1983') <=12when @NumActualMonths in (9,8,7) then month(t.Level0_level_alias + ' 23 1983') <=9when @NumActualMonths in (6,5,4) then month(t.Level0_level_alias + ' 23 1983'} <=6else month(t.Level0_level_alias + ' 23 1983') <=3END |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-07-06 : 10:23:43
|
quote: Originally posted by ironmonkey Not sure why i'm getting this error for the following queryIncorrect syntax near the keyword 'in'.case @NumActualMonthswhen @NumActualMonths in (10,11) then month(t.Level0_level_alias + ' 23 1983') <=12when @NumActualMonths in (9,8,7) then month(t.Level0_level_alias + ' 23 1983') <=9when @NumActualMonths in (6,5,4) then month(t.Level0_level_alias + ' 23 1983'} <=6else month(t.Level0_level_alias + ' 23 1983') <=3END
N 56°04'39.26"E 12°55'05.63" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-07-06 : 10:25:55
|
But you will get other errors later, because of the "less than or equal" to comparison.Why don't you slow down and tell us what you have and what you want? N 56°04'39.26"E 12°55'05.63" |
|
|
ironmonkey
Starting Member
8 Posts |
Posted - 2010-07-06 : 10:47:01
|
Hi PesoI'm trying to do the following: I need a where clause that will do the following.if @NumActualMonths = first column then delete all month records from second column. Where p3=1,2,3 (jan,feb,mar), p6(apr,may,jun)...etc0 01 p32 p33 p34 p3,p65 p3,p66 p3,p67 p3,p6,p98 p3,p6,p99 p3,p6,p910 p3,p6,p9,p1211 p3,p6,p9,p12Sorry if I'm not very good at explaining this.quote: Originally posted by Peso But you will get other errors later, because of the "less than or equal" to comparison.Why don't you slow down and tell us what you have and what you want? N 56°04'39.26"E 12°55'05.63"
|
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-07-06 : 10:58:22
|
[code]DELETE FROM YourTableNameHereWHERE YourColumnNameHere BETWEEN 0 AND (@NumActualMonths + 2) / 3 * 3[/code]The "YourColumnNameHere" is the column name holding the month value, ranging from 1 to 12.If you have no column with month values, replace "YourColumnNameHere" with an expression calculating the month number. N 56°04'39.26"E 12°55'05.63" |
|
|
ironmonkey
Starting Member
8 Posts |
Posted - 2010-07-06 : 12:28:13
|
Thanks Peso,That worked for me! |
|
|
|
|
|
|
|