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

MS SQL server 2005 : How to use SQLCMD to export data into fixed column format?

Hi,

I'm now using MS SQL 2005 and we would like to use the SQLCMD to export data from SQL server into a fixed column format text file.  Since our programs are programed in a way that accept fixed column data and re-program them to use other format seems not a feasible solution.

Kindly please help
0
StanleyLMW
Asked:
StanleyLMW
  • 3
  • 2
1 Solution
 
pivarCommented:
Hi,

It sounds like you should use BCP instead.

http://msdn.microsoft.com/en-us/library/ms162802.aspx

You can describe the format in the bcp format file.

/peter

0
 
StanleyLMWAuthor Commented:
Hi Peter,
Thx for your reply ... but, as mentioned by Microsoft, the BCP command is going to be replaced by SQLCMD.  Since this program will be used for long, so we would like to use SQLCMD instead rather than changing the program say after 1 or 2 years.
Any idea on how to do it using SQLCMD?
Stanley
0
 
pivarCommented:
I wasn't aware that bcp is going to be replaced. Where have you seen that?
0
 
pivarCommented:
osql is going to be replaced by sqlcmd. Perhaps that's what you're thinking of?
0
 
StanleyLMWAuthor Commented:
Hi Peter,
Maybe I got the wrong information from my friend.  You are right.  Only OSQL will be replaced.  Then I try bcp first.  Thanks a lot.
Cheers
Stanley
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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