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: Yesterday @ 6:06 PM
Points: 39,667, Visits: 36,794
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Favorite Quotes:
"Has anyone ever told you that a query you have written runs too fast?" - Dwain Camps - 6 Mar 2014

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 @ 12:11 AM
Points: 7,668, Visits: 13,791
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