October 1, 2009 at 7:50 am
New user to SSIS.
Used the Import/Export Wizard to create a SSIS package to extract data from Excel and import the data into an existing SQL table. Using the Flat File connection type. Some of the data has comma's in it and the import puts quotes around the strings with comma's in them. Need to remove the quotes in the SQL table so wrote the scripts below to do so and they work fine.
1) How do I include the replace/trim sql scripts in the SSIS package? In other words I want to have the SSIS package run the scripts to remove the quotes as part of the package process. Where and how is this done in SSIS?
2) Can a SSIS package be executed from within a SQL script? I would like to use a command button in my application that would run a SQL script or utility that would locate, call and execute the SSIS package. Can this be done and if so, how?
Thanks.
Quote Cleanup Scripts:
UPDATE dbo.IMP_tblImport
SET CompanyName = REPLACE(CompanyName,'"',' ')
WHERE CompanyName LIKE '%"%'
update dbo.IMP_tblImport
set companyname = (LTrim(Replace(CompanyName, ' ', ' ')))
UPDATE dbo.IMP_tblImport
SET Comments = REPLACE(Comments,'"',' ')
WHERE Comments LIKE '%"%'
update dbo.IMP_tblImport
set comments = (LTrim(Replace(Comments, ' ', ' ')))
October 1, 2009 at 8:09 am
1) Include a SQL Script Task in the control-flow, probably before your data-flow task runs.
2) Yes, but it is a Kludge and a potential security issue. SSIS, is not really meant for the development of end-user tools or functionality, it's really targeted at implementing operational features and background tasks.
However, if you feel the you must have this here are your options:
A) Have your client applications/SW run the SSIS package itself by using DTExec.exe at the command line. This is easily the most direct, least kludgey solution and it generally bypasses the security issues (because it just uses the Users or the Apps authorization, hopefully).
B) Write a stored procedure that uses sp_cmdshell to execute the package DTExec, at the command-line, from SQL Server. This works, but is obtuse (because you have to go out to DOS and then DTExec has to log back into SQL Server), and also could be a security problem.
C) Define a SQL Agent SSIS Job Step to run your package. This works, is probably secure, but is hard to implement (it's a PITA trying to run a Job from a session connection), and has reportability issues (as in, it runs asynchronously in another session, so your user will not know when its done or whether is was sucessful or not).
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
October 1, 2009 at 9:30 am
Previous reply:
1) Include a SQL Script Task in the control-flow, probably before your data-flow task runs.
I know that there are 2 panes in BIDS that display the different flows but not sure how to access or edit them to place the script.
Can you give me details on how to do this? I am relatively new to SSIS.
October 1, 2009 at 10:00 am
Control-flow works like you probably think it does. You drop tasks on it and then, connect their arrows to control the order and conditions of execution.
Data-flow, is really the internal data routing of a Data
Transformation task. Once you have a Data Transformation task in your control flow, then you open it up to go to it's data-flow where you can drop components and then use the arrows to control how the data is piped from component to component. However, If you do not have one of those, then you don't have to worry about it (for this question, anyway).
----------
However, longer term, if you are planning to use SSIS, then you will need to learn all of this. It's a huge and complicated subject, and I strongly recommend that you look around for some books or articles to help you get started with it.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply