SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to add variables to a table in SSIS


How to add variables to a table in SSIS

Author
Message
aliens218
aliens218
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 31
Hi all, I'm in need to import several flat files into a SQL table. I'm used to importing one at a time, but I'm new and starting to figure out SSIS. I do need to update a field in the destination table with the filedate (which is not always the current date or in any consistent format). So I was wondering if there are any methods to input this date variable in SSIS.
Evil Kraig F
Evil Kraig F
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8625 Visits: 7660
aliens218 (4/16/2013)
Hi all, I'm in need to import several flat files into a SQL table. I'm used to importing one at a time, but I'm new and starting to figure out SSIS. I do need to update a field in the destination table with the filedate (which is not always the current date or in any consistent format). So I was wondering if there are any methods to input this date variable in SSIS.


Not easily. Your best bet is to set it as a parameter when you call it for a particular file, then launch it using command line for SSIS packages. It's pretty much the only way you want to approach this.

You CAN get yourself msgboxes and the like via scripts, but they break the job if you ever run it outside of BIDS/VS, because it just hangs waiting for an answer.


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Johan F Möller
Johan F Möller
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 119
Im not totally sure what you're doing with SSIS but if the intention is to loop through a list of files and import its data into a table, this is how I'd do it:

In the control flow use a For each loop container to loop through the files, set each filename to a global variable
Inside the For each loop container use a Data Flow Task
Inside the Data Flow task Use a Flat File Source using the filename stored in the variable
Connect the Flat file source to a script component which would read the file date and set the date to an extra output from the script component
Connect the Script component output to the preferred Destination component (ADO/OLE Db etc..) and store the data, including the new data field

.................................................................................................................................................................

Linkedin profile
aliens218
aliens218
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 31
Thanks for the responses. I had heard about the ForEachLoop... not very familiar with it, but plan on reading up on it. Wish it had an easier solution.
aliens218
aliens218
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 31
Another thought: If I put these variables (Filedate, filename) in a separate lookup table, can I get SSIS Data flow task to pull this information from the lookup table? How would I go about doing that?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search