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-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 7:11 AM
Points: 177, Visits: 126
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


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 5:29 PM
Points: 3,513, Visits: 7,565
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-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 7:11 AM
Points: 177, Visits: 126
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: 2 days ago @ 3:55 PM
Points: 6, Visits: 42
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-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 7:11 AM
Points: 177, Visits: 126
Thanks for info rohit.But i want it in script task.
Post #1508272
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse