Insert Excel sheet values to SQL Server 2005
First of all Turn on the adhoc Distributed Quries in your SQL Server using below statement
sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\SQL\JobDetails.xls',
'SELECT * FROM [Sheet1$]')
Now u can view the excel data in your SQL SERVER DB.
If u want to insert values as table use as same below
SELECT * into jobdetails
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\SQL\JobDetails.xls',
'SELECT * FROM [Sheet1$]')
select * from jobdetails
No comments:
Post a Comment