Insert DateTime into SP

  • hey hi

    anybody knows how do i insert the current DateTime into a SP?

    it seemed SYSDATETIME is not recognise built-in function name.

    DECLARE @livedate DATETIME;

    Insert into tb1 (ErrorDate)

    values(@livedate);

    select CONVERT (date,SYSDATETIME());

  • mehmel (6/24/2009)


    hey hi

    anybody knows how do i insert the current DateTime into a SP?

    it seemed SYSDATETIME is not recognise built-in function name.

    DECLARE @livedate DATETIME;

    Insert into tb1 (ErrorDate)

    values(@livedate);

    select CONVERT (date,SYSDATETIME());

    First, what stored procedure? There isn't one above.

    Second, the code above should look like this:

    DECLARE @livedate DATETIME;

    SET @livedate = getdate();

    Insert into tb1 (ErrorDate)

    values(@livedate);

  • was going to put it in the SP. Thanks, it works!

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

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