• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

bcp - table to text file, how to capture field names

How can I tell sql server to export field names of a table, along with it's data to a text file? I don't see a switch that does this?
1 Solution
Aneesh RetnakaranDatabase AdministratorCommented:
In your Query put a select statement to select the filed names  followed by a UNION + the actual Query

Something like this

SELECT 'Address' UNION ALL SELECT Address FROM urTable
FeyoAuthor Commented:
Great. Thanks.
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

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

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