Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to load data from Excel file to sql server table using only script task in SSIS. Expand / Collapse
Author
Message
Posted Thursday, October 24, 2013 1:55 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 204, Visits: 263
Hi All,
Hope doing all well.

How to load data from Excel file to sql server table using only script task in SSIS?

I don't know coding. Please help me on this.

Thanks
Sibi.
Post #1508250
Posted Thursday, October 24, 2013 1:58 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 6:00 PM
Points: 4,041, Visits: 9,189
If you don't know coding, why would you want to do it with a script task if a data flow is the appropriate task for your situation?


Luis C.
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1508254
Posted Thursday, October 24, 2013 2:06 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 204, Visits: 263
Thanks for quick response Luis.

I am just practicing.
I know we can do that by tasks but, i want to learn how to do using script task only. I googled it but, not clearly mentioned.
Please let me know how to do it?

Thanks.
Post #1508260
Posted Thursday, October 24, 2013 2:14 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, October 13, 2014 3:40 PM
Points: 6, Visits: 47
HI

In order to load from Excel into SQL Server, you should have Bulk_admin database role rights on your ID with Insert permission on database.

you can use the below script to load data into sql server after that,

USE <DB_NAME>
GO
/** STEP 1 - CREATE TABLE **/ -- You need to create the table before inserting data with the columns mentioned in your excel
CREATE TABLE Load_Table(cust_no integer, cust_name varchar(20) )
GO
/** STEP 2 - BULK INSERT **/
BULK INSERT Load_table FROM 'FIle_location\file_name.xls' WITH (FIRSTROW = 2, FIELDTERMINATOR =',', ROWTERMINATOR ='')
GO

Post #1508264
Posted Thursday, October 24, 2013 2:36 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 204, Visits: 263
Thanks for info rohit.But i want it in script task.
Post #1508272
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse