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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Appending two txt files

Author  Topic 

divan
Posting Yak Master

153 Posts

Posted - 2012-10-24 : 07:02:21
good morning folks.. I have two txt files TRIBUTE_IND TRIBUTE_GRP that I need to append into TRIBUTE.TXT are there any sql commands that will do that?

Thanks

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-24 : 07:06:41
There are no native T-SQL commands that would append two files. You can use whatever you would use in Windows to append the files, but invoke it from T-SQL using xp_cmdshell. For example:
EXEC xp_cmdshell 'type C:\temp\TRIBUTE_IND >> c:\temp\TRIBUTE.TXT';
EXEC xp_cmdshell 'type C:\temp\TRIBUTE_GRP >> c:\temp\TRIBUTE.TXT';
Go to Top of Page

divan
Posting Yak Master

153 Posts

Posted - 2012-10-24 : 07:25:08
Good morning Sunitabeck

what does >> mean
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-24 : 07:34:53
quote:
Originally posted by divan

Good morning Sunitabeck

what does >> mean



Good morning! :)

Appends the command output to the end of a file without deleting the information that is already in the file.

See here: http://technet.microsoft.com/en-us/library/bb490982.aspx
Go to Top of Page
   

- Advertisement -