Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to generate SQL Script file using Script Task C#

$
0
0

Hi All,

I am trying to do the same in script task in SSIS. I would like to generate text file with insert statements. I am getting the input from Lookup transformation. I would like to generate insert and update statements in a text file with values. From lookup transformation it will generate maximum 100 values so i would like to generate a text file with 100(or depending on the output from lookup transformation) insert statement. I would like to generate a text file with the following output.

INSERT INTO crm_class
(class_name, [description], [status], [class_summary], class_price_type)
VALUES
(1, 2, 3, 4, 5)

INSERT INTO crm_class
(class_name, [description], [status], [class_summary], class_price_type)
VALUES
(1, 2, 3, 4, 5)

and so on upto the total values i will get for lookup transformation.

could you please guide me how would i do that in c#. the text file will be saved on a local drive i.e. e:\SQLScript

similarly update statements like this

UPDATE crm_organization
SET company_name = 'ABC', short_name ='Test', class_id = 1, isAgent = 0,
date_modified = COALESCE(@date_modified, GETDATE()),
comment = 'aaaaa', [status] = 'Active', entered_by = 'Emp', modified_by = 'James',
org_updated = 'Yes', link_updated = 'No'
WHERE company_id = '11'

Any help on this would be much appreciated.



MH


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>