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 |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2007-12-27 : 14:09:18
|
| well.. I need to append all text files in a specified directory to a file called abcde.txt using xp_cmdshell(if file already exits then it should overwrite it without any warning)Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-27 : 14:11:35
|
| You can append files using the type DOS command.type C:\Directory1\*.* > C:\abcde.txtTara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2007-12-27 : 14:18:27
|
| doesnt work strangely.. copies the existing files twice that ways ... besides i also need to trim the first 1 row of both files and then append the remaining rows into another file called abcde.txt |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-12-27 : 22:23:37
|
| Use this:type C:\Directory1\*.* >> C:\abcde.txt |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-27 : 23:01:13
|
| > will work just fine, not sure why sakets is having problem. I just ran a test and it works great. >> appends if the file exists already.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|
|