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
 Pipe Delimited

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-02-18 : 22:25:38
How can i add in the pipe delimited in TXT format?

select '"' + FirstName + '"' [FName],
'"' + LastName + '"' [LName]
from tableA

I would like the result as below:

"FirstName","LastName"
"Mary"|"Jane"
"John"|"Wayne"

Can I do that? Using BCP?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-18 : 23:39:06
you can

see

http://amitpatriwala.wordpress.com/tag/bcp-queryout-pipe-delimiter/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-02-19 : 02:35:30
But it doesnt include the column.
How can I do that?
Go to Top of Page

srimami
Posting Yak Master

160 Posts

Posted - 2013-02-19 : 04:08:10
I am not sure if this helps but you can do that in a simple way using Import/Export option

Import the table name you wanted to select in source and export in text file, change the delimited to vertical pipe and run the mapping.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-19 : 04:14:15
quote:
Originally posted by peace

But it doesnt include the column.
How can I do that?


see

http://beyondrelational.com/modules/2/blogs/70/posts/10846/export-to-excel-with-column-names.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -