Please Help. My Stored Procedure Doesn't Work

  • 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

  • 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

  • Thank you so much. It fixed the problem. I really appreciate it.

  • 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

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply