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, April 09, 2014 8:30 AM
Points: 148, Visits: 116
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


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 3:06 PM
Points: 2,763, Visits: 5,904
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.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

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, April 09, 2014 8:30 AM
Points: 148, Visits: 116
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: Thursday, January 23, 2014 6:13 PM
Points: 5, Visits: 26
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, April 09, 2014 8:30 AM
Points: 148, Visits: 116
Thanks for info rohit.But i want it in script task.
Post #1508272
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse