27 January,2012 by Jack Vamvas
Generate SQL Server INSERT statements with Excel Concatenate.
A developer requested access to a Production database. The details were to COPY and PASTE from a Excel spreadsheet into Access , which then updated SQL Server. Upon asking him , why he used this method , he said “It’s the way I always insert this data to the lookup table”.
There are better ways . One way , is to use the “Concatenate” function in Excel. It concatenates the ascii portions of the statement, adding single quotes where relevant.
In this example , there are four rows with the values in col A and B. Create the formula for the first line, the copy to the rest of the lines.
Copy and Paste the the INSERT statements directly into SQL Server Management Studio or create a text file.