small case but stuck here now

  • I've never noticed or had the issue before:

    I have a sp with some datetime parameters:

    ALTER PROCEDURE [dbo].[spUpdateDocInfoBySysID](@SysID int, @DocID int, @SelectedDocTitle varchar(255),

    @NewDocType int, @DocStatus varchar(10),

    @NewDateFirstIssued smalldatetime, @NewPreviousReviewDate smalldatetime, @NewNextReviewDate smalldatetime,

    @Note varchar(1000),

    @Contact varchar(50),

    @Phone varchar(20),

    @RiskRating int)

    exec [dbo].[spUpdateDocInfoBySysID] 2730, 1578, 'asdfasdfasdfasdf', 2, 'Active', CONVERT(datetime, '2011-10-30',103),CONVERT(datetime, '2013-01-22',103),CONVERT(datetime, '2222-02-22', 103)

    This threw me:

    Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'CONVERT'.

    exec [dbo].[spUpdateDocInfoBySysID] 2730, 1578, 'asdfasdfasdfasdf', 2, 'Active', '2011-10-30','2013-01-22','2222-02-22'

    This threw me:

    Msg 8114, Level 16, State 5, Procedure spUpdateDocInfoBySysID, Line 0

    Error converting data type varchar to smalldatetime.

    Can anyone point to me what's wrong with it? it has been working fine for quite a long time

  • http://msdn.microsoft.com/en-us/library/ms182418.aspx

    Smalldatetime has a max date of 2079-06-06. It looks like it is erroring out when you put in the 2222-02-22 as a date.

  • roryp 96873 (4/9/2013)


    http://msdn.microsoft.com/en-us/library/ms182418.aspx

    Smalldatetime has a max date of 2079-06-06. It looks like it is erroring out when you put in the 2222-02-22 as a date.

    Thank you for the quick reply, that explains why the frontend user failed to update info using the sp

Viewing 3 posts - 1 through 2 (of 2 total)

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