Excel dynamic splicing sql

Introduction:

        In many cases, the data given by the business is Excel, and the development needs to be converted into corresponding SQL statements and processed using Excel formulas

Show results:

 

Conversion script:

insert statement

="insert into table1 (name1,name2,name3)values('"&A1&"','"&B1&"','"&C1&"','"&D1&"');"

 update statement

="UPDATE table1 t SET t.name1 ='"&A1&"',t.name2 ='"&B1&"' WHERE t.ID ='"&A1&"';"

Script analysis:

        '"&A1&"': & (connector) A1 (name of the column where the condition is located)

Guess you like

Origin blog.csdn.net/qq_36521848/article/details/129158416