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 |
dnf999
Constraint Violating Yak Guru
253 Posts |
Posted - 2010-07-07 : 04:48:59
|
Hi I am trying to insert an IF statement in an SP, but get the following error:Msg 156, Level 15, State 1, Procedure spGL_Ledger_Filtering_v7, Line 957Incorrect syntax near the keyword 'IF'.Msg 156, Level 15, State 1, Procedure spGL_Ledger_Filtering_v7, Line 961Incorrect syntax near the keyword 'IF'.Msg 156, Level 15, State 1, Procedure spGL_Ledger_Filtering_v7, Line 972Incorrect syntax near the keyword 'DELETE'.Msg 102, Level 15, State 1, Procedure spGL_Ledger_Filtering_v7, Line 1984Incorrect syntax near ')'.Is it because of the Begin and ENd parts of the IF statement?IF @Ledger = '03' BEGIN --Exec sp... END IF @Ledger = '90' BEGIN --Exec sp... ENDIF @Ledger = '91' BEGIN --Exec sp... END |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-07-07 : 04:58:24
|
NO! As the error reports (last line) there is a problem with a paranthesis.There is no paranthesis in the code you posted.Also, the problem is probably orginating from the lines ABOVE 957, thinking the IF statement is part of the previous command. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|
|