Rabu, 29 September 2010

Import Excel to Sql Server 2008

Berikut salah satu cara import data dari excell ke sql server 2008 dengan query:

INSERT INTO _0
SELECT customerid, customername
FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\tes.xls;HDR=YES', 'select * from [Sheet1$]') AS A;
Jika dalam menjalankan query tersebut menemukan error : "SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online."

Jalankan query berikut:
sp_configure 'Ad Hoc Distributed Queries', 1
reconfigure

Semoga bermanfaat
Koral web

About Me

Koral Web
Kami adalah web developer. Beberapa produk yang pernah kami buat antara lain website, aplikasi klinik, aplikasi apotik, aplikasi EDMS (Electronic Database Management System), Energy Consumption Management System, RKBI (Rencana Kunjungan Barang Import) dan lain-lain sesuai dengan request dari client kami. Jika Anda tertarik untuk membuat system atau aplikasi, jangan sungkan-sungkan menghubungi kami.
Lihat profil lengkapku

Bahasa Pemrogramanmu?

Nasihat

Barangsiapa capek lelah dan letihnya bukan karena Allah maka celakalah dia
Diberdayakan oleh Blogger.

Blog Archieve

SMS Gratis