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 2000 Forums
 SQL Server Development (2000)
 SQLCMD Tab delimited text file

Author  Topic 

vgr.raju
Yak Posting Veteran

95 Posts

Posted - 2006-11-14 : 00:13:25
If some one knows how to create tab delimited text file in SQLCMD ,please let me know.
Thanks in advance

Thanks!
Raju
http://www.trickylife-trickylife.blogspot.com/

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-14 : 00:36:36
Try this:

sqlcmd -S (local) -E -s'\t' -Q "set nocount on select * from
table1" -o c:\out.tab -h-1 -W


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

vgr.raju
Yak Posting Veteran

95 Posts

Posted - 2006-11-14 : 08:48:10
Hi Harsh Athalye,
Thank you for your reply. It does not create a tab delimited text file.It puts the ' as delimiter and creates the file. -s'\t'.
Sample Output from the file:
Harsh Athalye
ALFKI'Alfreds Futterkiste'Maria Anders'Sales Representative'Obere Str. 57'Berlin'NULL'12209'Germany'030-0074321'030-0076545

Thanks!
Raju
http://www.trickylife-trickylife.blogspot.com/
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-11-14 : 11:19:46
Any reason you can't use bcp instead? It defaults to tab-delimited files.
Go to Top of Page

vgr.raju
Yak Posting Veteran

95 Posts

Posted - 2006-11-14 : 11:22:52
I have the need to query the table and send the Query results as excel attachment.
BCP Works great but it does not have the column names.
SQLCMD output contains the column names but the fomatting does not satisfy my needs.


Thanks!
Raju
http://www.trickylife-trickylife.blogspot.com/
Go to Top of Page

vgr.raju
Yak Posting Veteran

95 Posts

Posted - 2006-11-15 : 10:33:03
If someone know how to create the tab delimited text file output from SQLCMD ,please let me know. I have some urgent requirements.
Thanks in advance!


Thanks!
Raju
http://www.trickylife-trickylife.blogspot.com/
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-11-15 : 23:49:39
Change the single quotes to double quotes (") in harsh's example, should work fine.
Go to Top of Page
   

- Advertisement -