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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to combine two functions

Author  Topic 

JackOfAllTrades
Starting Member

12 Posts

Posted - 2009-04-14 : 16:48:33
Both of these provide an output, Neither output is in usefull form yet. What I'm looking to do is etract data and write it to text file with some text prepended and appened to the data in the text file, but not do anything to the data in the table.

select 'PrependTextHere' + OneColumn + 'AppendMoreText' + OneColumn + 'AppendMoreText' from Dbname.dbo.TestTable order by OneColumn

EXEC master..xp_cmdshell 'bcp "select OneColumn from DBname.dbo.TestTable" QUERYOUT c:\test.txt -c -S SQLtest -T'

-Steve

Colt's, Ruger's, Dan Wesson, & Kimber are my friends!
Proud to be a U.S. Navy Veteran.

JackOfAllTrades
Starting Member

12 Posts

Posted - 2009-04-14 : 19:20:40
Even if there's a means to create a stored procedure that would take the output of the first string and save it to file. That would be fine.

Colt's, Ruger's, Dan Wesson, & Kimber are my friends!
Proud to be a U.S. Navy Veteran.
Go to Top of Page
   

- Advertisement -