Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Import data From Excel File to Sql Server 2008 Using PL-SQL

Author: Zunnair

In this article I will explain the way in which we can Import Data from Excel file, This technique did not require any Kind of Format file.

This Article is So Simple to understand


First Create Schema for your Temp table in Sql Server.



Create table Temp


[Column1] as Varchar(200),

[Column2] as Varchar(200),

[Column3] as varchar(200),

[Column4] as varchar(200)



After that Set each Column Data Type varchar because while importing excel File we don’t want errors related to data type conversions.


After that write the following Query.



                       ([Column1], [Column2], [Column3], [Column4])


SELECT    A.[Column1], A.[Column2], A.[Column3], A.[Column4]

FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Excel.xls;HDR=YES', 'select * from Sheet') AS A;

This query insert Excel file records to your database tables. This is very simple and easy Article, I hope you will understand this.




Article Comments
i want to connect excel file with sql server

Posted on 4/24/2010 5:36:18 AM by Muhammad Adnan


I get the following error when I run the query:
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

Please advise

Posted on 8/24/2010 8:25:26 AM by Larita

Add Article Comment:
Name :
Email Address :
Comments :
<< Check existence of any table using PL-SQL in SQL server 2008.

Disclaimer - Privacy
© 2002-2017