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)
 pipe delimited text file

Author  Topic 

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-15 : 07:56:51

Hi pals,

I need to create a pipe/comma delimited text file which contains the results of SELECT statemnt using T-SQL.

For example,

I have a stored procedure say usp_generateTextFile which as select stmt as follows
select ltrim(str(empno))+','+ename+','+;ltrim(str(sal))
This output should get stored in a text file at c:\file1.txt.

How to do it.

Thanks in advance.
Regards,
franky


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-15 : 07:59:52
Use BCP command with -t and -r switches.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -