October 14, 2014 at 5:44 am
Hi Everyone. Can someone please tell me why the following query doesn't work?
USE [PAULS TEST DATABASE]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.Calendar
AS
BEGIN
SET NOCOUNT ON
DECLARE @Calendar_Table TABLE
(
Primary_key int NOT NULL IDENTITY(1,1) PRIMARY KEY
,Month_Year CHAR(7)
,Start_Date Date
,End_Date Date
)
INSERT INTO @Calendar_Table (Month_Year,Start_Date,End_Date)
VALUES
('01-2014','2014-01-01','2014-01-31')
,('02-2014','2014-02-01','2014-01-28')
,('03-2014','2014-03-01','2014-01-31')
,('04-2014','2014-04-01','2014-01-30')
,('05-2014','2014-05-01','2014-05-31')
,('06-2014','2014-06-01','2014-06-30')
,('07-2014','2014-07-01','2014-07-31')
,('08-2014','2014-08-01','2014-08-31')
,('09-2014','2014-09-01','2014-09-30')
,('10-2014','2014-10-01','2014-10-31')
,('11-2014','2014-11-01','2014-11-30')
,('12-2014','2014-12-01','2014-12-31');
SELECT * FROM @Calendar_Table;
GO
October 14, 2014 at 5:50 am
You forgot the END.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 14, 2014 at 5:55 am
Thank you so much. It fixed the problem. I really appreciate it.
October 14, 2014 at 5:57 am
ganteng1 (10/14/2014)
Thank you so much. It fixed the problem. I really appreciate it.
No problem, glad to help.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 14, 2014 at 6:16 am
Koen Verbeeck (10/14/2014)
You forgot the END.
Alternatively, you have a stray BEGIN.
BEGIN ... END aren't necessary for a stored proc.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply