If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Incorrect Syntax near '/'

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-11, 21:59
asherman86 asherman86 is offline
Registered User
 
Join Date: Nov 2011
Location: Houston, TX
Posts: 18
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
Quote:
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.
Reply With Quote
  #2 (permalink)  
Old 12-07-11, 22:23
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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?

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-07-11, 22:31
asherman86 asherman86 is offline
Registered User
 
Join Date: Nov 2011
Location: Houston, TX
Posts: 18
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;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On