July 10, 2012 at 1:39 pm
Hi,
I need help on SQL getting an error when pasting a stored procedure "error 42000 must declare the scalar variable "@DischargeEndDate" for the following code
PROCEDURE [dbo].[DR_Premier_PO_O] (@DischargeStartDate DateTime, @DischargeEndDate DateTime)
AS
DECLARE @vStartDate as varchar(30), @vEndDate as varchar(30)
SET @DischargeEndDate = DateAdd(mi,-1,@DischargeEndDate)
SET @vStartDate = CONVERT(varchar(30), @DischargeStartDate, 101)
SET @vEndDate = CONVERT(varchar(30), @DischargeEndDate, 101) + ' 23:59:58'
July 10, 2012 at 1:50 pm
You need to specify parameter is nullable or not
CREATE PROCEDURE [dbo].[DR_Premier_PO_O] (@DischargeStartDate DateTime =NULL, @DischargeEndDate DateTime =NULL)
AS
DECLARE @vStartDate as varchar(30), @vEndDate as varchar(30)
SET @DischargeEndDate = DateAdd(mi,-1,@DischargeEndDate)
SET @vStartDate = CONVERT(varchar(30), @DischargeStartDate, 101)
SET @vEndDate = CONVERT(varchar(30), @DischargeEndDate, 101) + ' 23:59:58'
July 10, 2012 at 1:51 pm
CREATE PROCEDURE [dbo].[DR_Premier_PO_O]...
you are just missing the word create; after that my syntax issues went away.
i got 4 errors total, and only the last matched your error.
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'PROCEDURE'.
Msg 137, Level 15, State 2, Line 7
Must declare the scalar variable "@DischargeEndDate".
Msg 137, Level 15, State 2, Line 9
Must declare the scalar variable "@DischargeStartDate".
Msg 137, Level 15, State 2, Line 10
Must declare the scalar variable "@DischargeEndDate".
Lowell
July 10, 2012 at 2:40 pm
Thank You
July 11, 2012 at 8:29 am
CREATE statement gives me an error which says "you do not have access to live-db". But when I run other reports I do not have any problem.
July 11, 2012 at 9:47 am
CREATE statement gives me an error which says "you do not have access to live-db". But when I run other reports I do not have any problem.
July 11, 2012 at 9:56 am
Sounds like you don't have permissions to create a stored procedure.
July 11, 2012 at 12:50 pm
Thank You
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply