ljhodgett
asked on
Incorrect syntax near the keyword 'convert' in stored procedure using sql server 2005
Hi,
I have the following code that is talking to a sql stored procedure: -
USE [testdata]
GO
DECLARE @return_value int,
@NewTestID uniqueidentifier,
@ErrorCode int,
@ErrorDescription varchar(255)
EXEC @return_value = [dbo].[AddNewTestData_v014 1]
@Operator = 13,
@SNumber = 1689,
@SerialNumber = N'A08171470380006',
@DateTimeStart = convert(datetime,'2008-04- 22 13:35:00',120),
@DateTimeStop = convert(datetime,'2008-04- 22 13:36:00',120),
@TestResult = N'1',
@Assembly = N'AH387775U001',
@StageRefNum = 945,
@TransactionNo = 2,
@NewTestID = @NewTestID OUTPUT,
@ErrorCode = @ErrorCode OUTPUT,
@ErrorDescription = @ErrorDescription OUTPUT
SELECT @NewTestID as N'@NewTestID',
@ErrorCode as N'@ErrorCode',
@ErrorDescription as N'@ErrorDescription'
SELECT 'Return Value' = @return_value
GO
It keeps on coming up: -
Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'convert'.
The two date parameters are set to datetime.
What am I doing wrong please?
Many Thanks
Lee
I have the following code that is talking to a sql stored procedure: -
USE [testdata]
GO
DECLARE @return_value int,
@NewTestID uniqueidentifier,
@ErrorCode int,
@ErrorDescription varchar(255)
EXEC @return_value = [dbo].[AddNewTestData_v014
@Operator = 13,
@SNumber = 1689,
@SerialNumber = N'A08171470380006',
@DateTimeStart = convert(datetime,'2008-04-
@DateTimeStop = convert(datetime,'2008-04-
@TestResult = N'1',
@Assembly = N'AH387775U001',
@StageRefNum = 945,
@TransactionNo = 2,
@NewTestID = @NewTestID OUTPUT,
@ErrorCode = @ErrorCode OUTPUT,
@ErrorDescription = @ErrorDescription OUTPUT
SELECT @NewTestID as N'@NewTestID',
@ErrorCode as N'@ErrorCode',
@ErrorDescription as N'@ErrorDescription'
SELECT 'Return Value' = @return_value
GO
It keeps on coming up: -
Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'convert'.
The two date parameters are set to datetime.
What am I doing wrong please?
Many Thanks
Lee
ASKER
Hi,
It comes back with the error message: -
Msg 155, Level 15, State 2, Line 1
'datetime' is not a recognized CURSOR option.
Msg 155, Level 15, State 2, Line 2
'datetime' is not a recognized CURSOR option.
Msg 137, Level 15, State 2, Line 6
Must declare the scalar variable "@return_value".
Best Regards
Lee
It comes back with the error message: -
Msg 155, Level 15, State 2, Line 1
'datetime' is not a recognized CURSOR option.
Msg 155, Level 15, State 2, Line 2
'datetime' is not a recognized CURSOR option.
Msg 137, Level 15, State 2, Line 6
Must declare the scalar variable "@return_value".
Best Regards
Lee
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DECLARE DateTimeStart datetime
DECLARE DateTimeStop datetime
SET DateTimeStart = convert(datetime,'2008-04-
SET DateTimeStop = convert(datetime,'2008-04-
EXEC @return_value = [dbo].[AddNewTestData_v014
@Operator = 13,
@SNumber = 1689,
@SerialNumber = N'A08171470380006',
@DateTimeStart,
@DateTimeStop,
@TestResult = N'1',
@Assembly = N'AH387775U001',
@StageRefNum = 945,
@TransactionNo = 2,
@NewTestID = @NewTestID OUTPUT,
@ErrorCode = @ErrorCode OUTPUT,
@ErrorDescription = @ErrorDescription OUTPUT