Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    27

    Unanswered: getdate() mystery

    when tried execute a stored procedure which uses getdate() function as a variable it produced error message like this
    MSG 102, Level 15, State 1, Line 10
    Incorrect syntax near ')'.
    the query is given below

    GO
    DECLARE @return_value int
    EXEC @return_value = [dbo].[INSERT_CALLBACK_67]
    @PHONE ='46346',
    @CALLBACKTIMEORG = getdate(),
    SELECT 'Return Value' = @return_value
    GO

    then i rewrite the query and executed by declaring getdate() function as given below, it gave correct result

    USE [testy5]
    GO
    DECLARE @return_value int
    DECLARE @dt DATETIME;
    SET @dt = GETDATE();
    EXEC @return_value = [dbo].[INSERT_CALLBACK_67]
    @PHONE = '6757866',
    @CALLBACKTIMEORG = @dt,
    SELECT 'Return Value' = @return_value
    GO

    why this is happening ,i would like know the concept behind

    thanks in advance

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    according the syntax and dbo schema - this must be related to sqlserver
    this forum is related to DB2 ..
    probably wrong forum for you..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Dec 2011
    Posts
    27
    i have posted this same in sql forum also

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •