Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Location
    Houston, TX
    Posts
    32

    Unanswered: Incorrect Syntax near '/'

    more fun in the life of a fledgling database developer.

    Code:
    USE [ClaytorsCottages]
    GO
    
    DECLARE	@return_value int
    
    EXEC	@return_value = proc_NewReservation
    		@AvailID = 0,
    		@UserID = 8,
    		@Begin = 12/09/2011,
    		@End = 12/12/2011
    
    SELECT	'Return Value' = @return_value
    
    GO
    Msg 102, Level 15, State 1, Line 7
    Incorrect syntax near '/'.
    ... I can not imagine what this thing thinks is wrong with the syntax of that date, and why the syntax of the second date is perfectly acceptable.

    The Stored procedure looksa like this:
    Code:
    /****** Object:  StoredProcedure [dbo].[proc_NewReservation]    Script Date: 12/07/2011 20:58:28 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    ALTER PROCEDURE [dbo].[proc_NewReservation]
    	@AvailID Int,	@UserID Int,
    	@Begin DATE, @End DATE
    
    AS
    	BEGIN
    		INSERT INTO tblGuestReservations (AvailID, UserID)
    		VALUES (@AvailID, @UserID)
    	END
    	
    	BEGIN
    		UPDATE tblAvailableRooms
    		SET	Reserved = 1, ResBegin = @Begin, ResEnd=@End
    		WHERE AvailID = @AvailID
    	END
    I must say what the heck.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    12/09/2011 isn't a date, it's an arithmetic expression (12 divided by 9 divided by 2011)

    '12/09/2011' is a date

    see the difference?

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2011
    Location
    Houston, TX
    Posts
    32

    Thumbs up

    Well I'll be a son of a.... >.<


    Thank you. This is what happens when you spend 12 hours straight working on a project. O_o;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •