Groups | Blog | Home
all groups > sql server (microsoft) > july 2005 >

sql server (microsoft) : Incorrect synatax near the keyword DECLARE


tabladude NO[at]SPAM gmail.com
7/21/2005 8:31:54 AM
Hi:

I added this bit of code to my sproc and am getting the error
"Incorrect syntax near the keyword DECLARE" and also "Incorrect Syntax
Near ','". I'm tearing my hair out trying to figure out what is wrong.
This is just the new bit of code, let me know if you need to see the
whole sproc (@Select_Policy is an input parameter):


DECLARE @PolicyThreshold int,
DECLARE @SysThresh_AuditMonth datetime

SELECT @PolicyThreshold = CP_Table FROM PD_Table WHERE
id = @Select_Policy

SELECT @SysThresh_AuditMonth = MIN(AuditMonth) FROM
#temp_SystemCompliance

WHILE @SysThresh_AuditMonth < getdate()
BEGIN

INSERT INTO #temp_SystemCompliance
(-1),
'Sys Compliance Threshold',
@SysThresh_AuditMonth,
(-1),
(-1),
(-1),
'Sys_Compliance_PlaceHolder',
'Sys_Compliance_PlaceHolder',
'Sys_Compliance_PlaceHolder',
'Sys_Compliance_PlaceHolder', (-1),
'Sys_Compliance_PlaceHolder',
(-1),
(-1),
@SysThresh_AuditMonth,
@SysThresh_AuditMonth, 0, 0, 0, 0, @PolicyThreshold , 0, 0, 0, 0,
0, 'pass', 'pass', 'pass', 'pass'

SET @SysThresh_AuditMonth = DATEADD(mm,1,@SysThresh_AuditMonth)
END



Thanks,
Kayda
Wolf
7/21/2005 6:43:18 PM
Wrong syntax. Use either

DECLARE @PolicyThreshold int
DECLARE @SysThresh_AuditMonth datetime

or

DECLARE @PolicyThreshold int,
@SysThresh_AuditMonth datetime

but NOT

DECLARE @PolicyThreshold int,
DECLARE @SysThresh_AuditMonth datetime
AddThis Social Bookmark Button