listi.net

Listi.net

             


Creating SQL statements using Excel

Today I received a list of data from a colleague in an Excel spreadsheet. I needed to take this information and retrieve other information from a database.

On the spreadsheet data is in column A. In column B put the following:

="insert into #tmp value ('"&A1&"')"

Then fill down the data

in your SQL app

Create table #tmp (
f1 varchar(20)
)

copy and paste the SQL statements and run. You now have a temp table that can be used to extract other information from your database.