In the process of doing development, often need to according to the data in Excel database query, a small amount of data can also be copied and pasted, a large amount of data need to be in Excel data stitching into their own required SQL to improve productivity.
Scenario 1: Stitching a column into an in condition in SQL
Suppose you now have the following Excel data, I need to query the data from the database
The operation method is as follows:
Copy the resulting column of data into visual Studito code and replace it
Scenario 2:To stitch a column into a list in C #
Assuming that you now have the following Excel data, I need to write these values in list<string> in C #
The operation method is as follows:
Copy the resulting column of data into visual Studito code and replace it
Scenario 3: Stitching SQL statements
If you have the following SQL statement, you now need to replace the value of Storecode in the Where condition with the value in Excel
SELECTSt. Storecode, St. StoreName, S.sellername, so. Sellerorgname fromDbo. Fct_store asStINNER JOINDbo. Fct_seller asS onS.disabled= 0 andSt. Sellercode=S.sellercodeINNER JOINDbo. config_sellerorg asSo onSo. Disabled= 0 andS.sellerorgcode=So . SellerorgcodeWHERESt. Disabled= 0 andSt. Storecode= '10000196';
Copy the SQL statement into Excel as described in Scenarios 1 and 2, prompting for the following information:
At this point, you need to use the concatenate () function in Excel, as follows:
Excel 2013 Stitching SQL strings