A Problem in creating "Update" procedure

  • I am creating a procedure for update table

    and in that i am updating date (not datetime) for which i am using varchar datatype

    But when i execute the error appears as incorrect syntax

    The format i try to use are "11-03-2008", "11/03/2008"

    But the error appears for "-" and "/"

    am i using the wrong format??

    What is the wayout for my problem? How can i enter the date value or how should i choose datatype?

  • Hi,

    you are updating date value which have varchar datatype then use

    same datatype of parameter value in usp.

    if you are using query window to write a query then pass value in single quotes.

    if this is solution of your problem else describe again your problem.

    Regards

    Sarvesh Kumar Gupta

  • I think Sarvash hit the issue with the single quotes.

    Instead of "3/3/2008" in your SQL code. It should be '3/3/2008'

    Single quotes define a string, not double quotes, in TSQL.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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