i know a way to read excel from sql query.
this is how to do it...
first of all:
reconfigure 'Ad Hoc Distributed Queries' to enable position by run this query:
sp_configure 'Ad Hoc Distributed Queries', 1
reconfigure
to check or view the value of configuration run this query : "sp_configure" (find 'Ad Hoc Distributed Queries')
second:
SET IDENTITY_INSERT [table] ON
the main formula is :
select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; Database=[FOLDER LOKASI DI SERVER]\FileExcelnya.xls', 'select * from [Sheet1$]')attention!! the first row become the field name on sql
dont forget to
SET IDENTITY_INSERT [table] OFF
*condition: only read excel version 97-2003
No comments:
Post a Comment