Hi Guys,
I have wrote a stored procedure to help me in insert data into table but when i Execute the procedure from the Management Studio it throw an error about one of data type which is @ExpiryDate which is declared as dateTime as the error saying
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near '/'.
the sproc as follow:
ALTER PROCEDURE [dbo].[main_Escort_Insert]
-- Add the parameters for the stored procedure here
@EscortID int,
@FirstName varchar(50),
@Surname varchar(50),
@CrbCheck bit = 0,
@CrbRef bit = false,
@ExpiryDate dateTime = null,
@Training bit = false,
@TrainingType bit = false
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @Escort int
-- Insert statements for procedure here
Insert Into tb_Escorts (EscortID, FirstName,Surname, [CRB_Check], [CRB_Ref],ExpiryDate, Training, TrainingType)
VALUES(@EscortID,@FirstName,@Surname,@CrbCheck,@CrbRef,@ExpiryDate,@Training,@TrainingType)
Any advice when i execute i enter the following for the ExpiryDate as follow@ExpiryDate =31/01/2015,
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near '/'.
I'm using SQL 2012
any idea what format should i use to insert a date when executing the sproc from the SQL Studio Management
thank you in advance
saurabh mittalPosted Feb 28, 2014, 2:42 AM
I got ur word.if u r taking datetime format than pass
date in '2014-02-28 00:00:00.000' format. if u don't
write time in this format that's fine.i have run this in
my system that's working properly. i think that's correct.
and in table column u also select datetime.
Abbas HamzaPosted Feb 28, 2014, 4:54 AM
Thank you for your feedback , it was strange one at first it was the same errors then I restarted Management Studio and now is working fine.
Thank you for your input it did help
Abbas HamzaPosted Feb 27, 2014, 11:45 AM
saurabh mittalPosted Feb 27, 2014, 8:40 AM
like:'03/04/2013'
than itwill insert successfully