Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011

    Unanswered: incorrect syntax near '+' please help

    while executing one of my sp i got an error saying
    incorrect syntax near '+'

    exec usp_InsertUpdateModulePageAssociation '<root><association module_Id=1 pageId=7 updatedBy=1 updateDateTime=' +//this plus sign is the problem '(''2012-05-20 14:56:02.897'')' + '/></root>'

    i am doing this because i want to send datetime in single quote like '2012-05-20 14:56:02.897'
    can you help me please ?

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    The EXECUTE statement in Transact-SQL only supports constants and variables, it does not support expressions. If you need to compute a value to pass like you do here, either precompute it in your application code and send the result as a constant or create a Transact-SQL variable and set its value as a separate step before you call the EXECUTE statement.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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