Excel生成Sql语句 格式如:="字符串1"&A2&"字符串2"&C2&"字符串3"

我们有时候需要根据Excel生成sql语句,可以利用Excel的字符串拼接&。格式如:="字符串1"&A2&"字符串2"&C2&"字符串3"

 

 

例如:在一个Excel中,我们要在Data_Company表中,根据CompanyCode(对应Excel表中的C列)修改DistributorAccount(对应Excel表中的A列)。

Excel生成Sql语句 ="update Data_Company set DistributorAccount='"&A2&"' where CompanyCode='"&C2&"'"
 
生成之后的Sql语句 update Data_Company set DistributorAccount='jiaoyang' where CompanyCode='004C'

 

posted @ 2019-09-18 16:16  小确幸123  阅读(546)  评论(0编辑  收藏  举报