Update script

  • What wrong with this script?

    UPDATE [Table1]

    SET [Application_Vendor]

    ,[Application_Name]

    ,[Version]

    ,[MS_Vista_Compatible]

    ,[Application_Owner]

    ,[Contact]

    ,[Region]

    ,[Business_Area]

    ,[Comments]

    WHERE (Application_Vendor = @Application_Vendor) AND (Application_Name = @Application_Vendor) AND (Version = @Version) AND

    (MS_Vista_Compatible = @Ms_Vista_Compatible) AND (Application_Owner = @Application_Owner) AND (Contact = @Contact) AND (Region = @Region)

    AND (Business_Area = @Business_Area) AND (Comments = @Comments)

    error is incorrect syntax near ',' :w00t:

  • You're not setting the columns to any values. You should have somthing like:

    SET [Application_Vendor] = @vendorval

    ,[Application_Name] = @nameval

    etc.

    Greg

  • ...and in that case your WHERE clause would make no sense (since all of the columns you want updated are already equal to the values you want to set them to).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I don't understand your comment Matt. The variables in my example are different than the ones in the OP's WHERE clause.

    Greg

  • I hear you Greg - I was actually more addressing the OP's where clause.

    It just looked to me that he had put the values he wanted the columns SET to in his where clause, in which case the WHERE clause should be omitted (or radically changed) in the final result.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Okay, I get it. Thanks

    Greg

Viewing 6 posts - 1 through 5 (of 5 total)

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