[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to export BCP with Pipe Delimiter

Posted on 2015-01-12
4
Medium Priority
?
1,700 Views
Last Modified: 2015-01-14
Hi..
What is the syntax to export with a pipe '|' as delimiter


this if for CSV or comma


set @s = 'bcp "'+ @SQL + '" queryout ' + @FilePath + ' -c -t, -T'
exec master..xp_cmdshell @s
0
Comment
Question by:JElster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 40546873
Delimiter for what? Field or row?
Field delimiter: set @s = 'bcp "'+ @SQL + '" queryout ' + @FilePath + ' -c -t ¦ -T'
Row terminator: set @s = 'bcp "'+ @SQL + '" queryout ' + @FilePath + ' -c -t, -T -r ¦'
0
 
LVL 1

Author Comment

by:JElster
ID: 40546878
field
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 40546886
Then is the first solution. You defined as comma so you just need to change it to pipe.
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 40548894
Note that the pipe character is a special character to the command interpreter. You need to escape it using the Circumflex character:
set @s = 'bcp "'+ @SQL + '" queryout ' + @FilePath + ' -c -t^| -T'

Open in new window

0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question