Blog

Import Excel Data into SQL Temp table

Posted by nilay mistry Blogs | SQL Feb 14, 2013
In this blog you will learn import excel data into SQL temp table.
  •   I have following excel sheet and I want to import all data into temp SQL table.

    execelsheet.png
  •   SQL Server OpenRowSet command can do data transformation easily. You can do that with following simple query in SQL.

·         I created simple temp table in SQL and import all rows from excel sheet into temp table.

INSERT  INTO [dbo].[#tblImport]

SELECT  Code, BasicSalary, GrossSalary

FROM   OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel12.0;HDR=YES;Database=D:\Salary_Register_offshore.xlsx', 'SELECT * FROM [Sheet1$]');

Output

 output.jpg

COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
More Blogs from this Blogger
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.