Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Inserting data from excel sheet

Author  Topic 

sgondesi
Posting Yak Master

200 Posts

Posted - 2014-12-09 : 07:25:20
Hi Everyone,

I am trying to insert data into a table from an excel sheet using bulk insert statement.
This excel sheet has number of tabs.
How can I mention a specific tab in bulk insert statement.

Thanks in advance.

--
Thanks and Regards
Srikar Reddy Gondesi,
BTECH-IT 2013 Passed Out,
Junior SQL Server DBA,
Miracle Software systems, Inc.

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-12-09 : 09:28:10
I would use SSIS, not BULK INSERT for this job. Reasons:

1. your excel files probably don't live on your SQL Server (nor should they, IMHO). That means that the database engine needs access permissions to the network share or wherever the excel files actually live. Using SSIS, you can set up a special purpose proxy account that DOES have the permissions needed but no more than actually needed.
2. SSIS packages can be easily parameterised and run via SQL Server Agent, specifying different parameters for different source locations.

However, if you really want to, here's a link that should help: https://www.simple-talk.com/sql/database-administration/getting-data-between-excel-and-sql-server-using-odbc--/
Go to Top of Page
   

- Advertisement -