TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Inserting Bulk Data from an XLSX File
Julian
May 04
2015
Code
1.7
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
fr--Enable the SQL Server Advance Options
sp_configure
'show advanced options'
, 1
RECONFIGURE;
GO
--Enable the Ad Hoc Queries
sp_configure
'Ad Hoc Distributed Queries'
, 1;
RECONFIGURE;
GO
--------------------------------------------
-- The Database driver is Microsoft.ACE.OLEDB.12.0 , Excel version 12.0
-- SELECT *
-- FROM OPENROWSET
-- ('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=<<filename>>;HDR=YES',
-- 'SELECT * FROM <<sheetname>>')
-- Example
SELECT
*
FROM
OPENROWSET
(
'Microsoft.ACE.OLEDB.12.0'
,
'Excel 12.0;Database=C:\Employee.xlsx;HDR=YES'
,
'SELECT * FROM [Sheet1$]'
)
BULK INSERT
SQL Server