Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-09-14 : 16:51:42
|
Hi, there,I need your help on a t-sql that will manipulate flat text files in the following way. Let's say I have 3 files:mytext1.txtmytext2.txtmytext3.txtI want to merge them into mytextMaster.txt using t-sql script.Then I can use the master file as the source for a DTS.All of them have the same structure. The reason I cannot use them as source to my DTS is that their file names are unknown at design time. I understand physical file manipulation typically tasked to the app team. Again, Mr. Nigel Rivett's site has excellent contents dealing with my task at hand.(http://www.nigelrivett.net/)Here are two ways I have tried, and the reason I am looking for something else.1. Using bcp insert to "Importing text files"The text file has long column list with white spaces. Without third party tool, parsing out each field correctly, i.e. figuring out the x & Y in each substring(str, x, y) will be very labor intensive. 2. using ActiveX to dynamically "Configuring dts package elements (i.e. source file name) at run time"I want my solution to be transferable to sql2005. VBScript could cause trouble.Thanks! |
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2007-09-15 : 22:59:32
|
Hi As You Say"All of them have the same structure. "Why not use copy mytext1.txt + mytext2.txt + mytext3.txt mytextMaster.txt attC. Lages |
 |
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-09-16 : 21:06:09
|
DOS cmd? in xp_cmdshell?Let me try. |
 |
|
|
|
|