Update sql server from excel

Wednesday, 30 May 2012

Update sql server from excel


update tablename set column=t2.column1 from
(
Select ID,column1,column2  FROM
OPENROWSET
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls;HDR=YES', 'SELECT  * FROM [SheetName$]'))t2
Where
tablename.ID = t2.ID

No comments:

Post a comment