从sql表加入Excel Sheet

时间:2017-02-07 13:15:30

标签: mysql sql-server excel-vba vba excel

遇到运行时错误

  

不正确的Syntex

C:\Users\Emp_ID\Desktop\FolderName\FileName.xlsm

set rs = cnn.Execute("update EO_datawh.dbo.TableName set email_status = 'Sent' From '" & ThisWorkbook.FullName & "'.'Sheet1$' a join EO_datawh.dbo.TableName b on a.sr_number = b.sr_number")

1 个答案:

答案 0 :(得分:0)

使用别名' b'而不是' EO_datawh.dbo.TableName'在更新之后:

set rs = cnn.Execute("update b set email_status = 'Sent' From '" & ThisWorkbook.FullName & "'.'Sheet1$' a join EO_datawh.dbo.TableName b on a.sr_number = b.sr_number")