--1.XL sheet to Table
Insert into Table2 Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\test.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')
--2.Select data from xl and display in SQL Server Management
Select * from openrowset('microsoft.jet.oledb.4.0',
'Excel 8.0;database=D:\Test.xls',
'select * from [Sheet1$]')
--3.Insert data from SQL Table to XL sheet.
Insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\Test2.xls;',
'SELECT * FROM [Sheet1$]') select * from Table2
Insert into Table2 Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\test.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')
--2.Select data from xl and display in SQL Server Management
Select * from openrowset('microsoft.jet.oledb.4.0',
'Excel 8.0;database=D:\Test.xls',
'select * from [Sheet1$]')
--3.Insert data from SQL Table to XL sheet.
Insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\Test2.xls;',
'SELECT * FROM [Sheet1$]') select * from Table2
No comments:
Post a Comment