• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • 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?
0
Feyo
Asked:
Feyo
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
0
 
FeyoAuthor Commented:
Great. Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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