Sql server从Excel更新查询

时间:2014-10-20 16:43:19

标签: sql sql-server excel function

我正在尝试使用excel函数编写一个Sql查询,但我收到函数错误我是新来的ms excel可以任何人帮我修复这个也请解释excel函数中的转义字符 -

这是我写的并且收到错误

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

TIA -

1 个答案:

答案 0 :(得分:1)

@ jbarker2160在评论中得到了它:你最后错过了一个引号,你的SQL查询需要在字段名称之间加上逗号。发布公式,因为我在看到评论之前写了:如果jbarker2160想要做同样的事情,请将答案标记为正确。

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