Sachin Prasad
Sachin Prasad

Reputation: 5411

Sql server Update query from Excel

I am trying to write a Sql query using excel function but i am getting function error i am new to ms excel can any one help me to fix this also please explain about escape characters in excel function -

Here is what i have written and getting error

   =CONCATENATE("UPDATE tbl_User SET ContactId=","'",B2,"'"," UserName=","'",E2,"'","Email=","'",E2,"'"," WHERE UserName=","'",D2,"')

TIA -

Upvotes: 0

Views: 72

Answers (1)

AHiggins
AHiggins

Reputation: 7219

@jbarker2160 got it in the comments: you are missing a quotation mark at the end, and your SQL query needs to have commas between the field names. Posting the formula, since I wrote it up before seeing the comments: if jbarker2160 wants to do the same, please mark his answer as correct.

=CONCATENATE("UPDATE tbl_User SET ContactId=","'",B2,"'",", UserName=","'",E2,"'",", Email=","'",E2,"'"," WHERE UserName=","'",D2,"'")

Upvotes: 1

Related Questions