• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 46
  • Last Modified:

Export the results of a view to a pipe-delimited csv file, including the column names

Couldn't find the answer on EE with a search, so here goes:
This concerns a search for SQL Server T-SQL code to use in a SQL Server 2014 EXPRESS (pay attention!  I said SQL Server EXPRESS!) database stored procedure.
I want to export the results of a view (which puts all the fields in the  proper varchar format) to a pipe-delimited csv file, including the column names.
This usp will be run by  non-sysadmin users.
All I want is simple sample T-SQL code that goes between the "BEGIN" and "END" statements to do this.  
Don't worry about inputs, outputs, or variables other than those specific to you sample code.
Don't read between the lines or make this harder than it needs to be - KISS.....
Thanks.
0
Mark Edwards
Asked:
Mark Edwards
  • 4
  • 2
1 Solution
 
Mark WillsTopic AdvisorCommented:
Is it Express "With Advanced Services" ?

In which case, let's try at a command prompt  C:\  BCP -v

And see what version, or, if there are issues.

There are a couple of possibilities, but let's try the obvious first. Have you used BCP before ?
0
 
Mark EdwardsChief Technology OfficerAuthor Commented:
No.  I'm use to using Access front-end to do exports to csv, but I want to use a usp this time to increase my skills in t-sql.  Not sure about "advanced services".  I'll have to ask....
0
 
Mark EdwardsChief Technology OfficerAuthor Commented:
My dba says we have ad. services, if this helps....
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Mark EdwardsChief Technology OfficerAuthor Commented:
@Mark:  I'm testing BCP now.  I found a great explanation and samples in the "SSIS" chapter of a book titled "Microsoft SQL Server 2014 Unleashed".  
My problem with trying to work out solutions for things like this is due to my inability (or so t seems) to boil-down complex syntax explanations into the (seemingly) simple solution that I'm looking for.
One of the problems with the internet is that you can type a little bit of text, then make a bunch of links to other references that provide all the other pieces, that, hopefully, give you what you're looking for if you have the time and expertise to slog through it all.... :-(

Thank goodness for books!!!!!
0
 
Mark WillsTopic AdvisorCommented:
>> Testing BCP now

Good to see

>> Thank goodness for books!!!!!

Absolutely :)
0
 
Mark EdwardsChief Technology OfficerAuthor Commented:
OK!  I'll wrap things up by closing this out.  Thanks Mark W.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now