Incorrect syntax while entering date value in procediure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nishu5047
    New Member
    • Dec 2014
    • 1

    Incorrect syntax while entering date value in procediure

    i have on procedure named as VouMasterEntry
    that is :-
    Code:
    Create PROCEDURE [dbo].[VouMasterEntry] 
    	-- Add the parameters for the stored procedure here
    	@VouNum int,
    	@CustID nvarchar(30),
    	@VouCat char(10),
    	@VouType Char(15),
    	@Seldate smalldatetime
    AS
    BEGIN
    	-- SET NOCOUNT ON added to prevent extra result sets from
    	-- interfering with SELECT statements.
    	SET NOCOUNT ON;
    
        -- Insert statements for procedure here
    	Insert A_VouMaster(VouNum,CustId,VouCat,VouType,EntryDate)
    	values (@VouNum,@CustID,@VouCat,@VouType,GETDATE())
    	
    	
    END
    now when i m inserting the data into the procedure through then it raises one error :-

    Incorrect Syntax Near "/"

    may be its of date which i m entering through vb
    but i can not find the solution
    plz help
    Last edited by Rabbit; Dec 7 '14, 03:43 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    Probably you send the date ('Seldate') in the wrong format.

    Base on what i read here:
    I have the field: APP_DATE (smalldatetime) I'm doing this query: INSERT INTO table (TYPE, CODE, APP_DATE, DATE) VALUES ('APP', '123', '02/10/2010 12.30', GETDATE()) It fails: Msg 296, Level 16, ...


    Currently there's a '/' in your date which causes the error

    Try to send it as 'YYYYMMDD HH:MM:SS'
    (i.e. '20141207 15:46:00')

    Comment

    Working...