Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

Pull "unformatted" data into existing table structure via SSIS? Expand / Collapse
Posted Thursday, March 14, 2013 11:24 PM



Group: General Forum Members
Last Login: Today @ 4:15 PM
Points: 42,082, Visits: 39,476
BWAAA-HAAA!!!! opc.three and a lot of others are going to hate me for this.

This is an easy task in T-SQL using xp_CmdShell, dynamic SQL to build "BCP out" commands to build a format file for each table programmatically. Then you don't even need SSIS because you can then use BULK INSERT right from T-SQL using the format files. In fact, even the BULK INSERT commands can be built programmatically with just a smidgin of forethought and planning. It only needs to be done once so hopefully no one gets too cranky about using the wonderful tool known as "xp_CmdShell".

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

Helpful Links:
How to post code problems
How to post performance problems
Post #1431359
Posted Friday, March 15, 2013 9:41 AM



Group: General Forum Members
Last Login: Today @ 4:14 PM
Points: 7,933, Visits: 14,358
Barkingdog (3/14/2013)
Thank you very much!


You're quite welcome!

There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1431599
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse