top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

0 votes
311 views
How to Import data From Excel File to Sql Server 2008 Using PL-SQL?
posted Mar 19, 2016 by Sathyasree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

INSERT INTO [tblTemp]
                       ([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;
answer Mar 19, 2016 by Shivaranjini
...