SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Pipe Delimited
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

peace
Constraint Violating Yak Guru

389 Posts

Posted - 02/18/2013 :  22:25:38  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 02/18/2013 :  23:39:06  Show Profile  Reply with Quote
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

389 Posts

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

srimami
Posting Yak Master

160 Posts

Posted - 02/19/2013 :  04:08:10  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 02/19/2013 :  04:14:15  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000