Solved

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

Posted on 2009-03-30
5
552 Views
Last Modified: 2012-05-06
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
Comment
Question by:StanleyLMW
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 500 total points
Comment Utility
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
 

Author Comment

by:StanleyLMW
Comment Utility
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
 
LVL 22

Expert Comment

by:pivar
Comment Utility
I wasn't aware that bcp is going to be replaced. Where have you seen that?
0
 
LVL 22

Expert Comment

by:pivar
Comment Utility
osql is going to be replaced by sqlcmd. Perhaps that's what you're thinking of?
0
 

Author Comment

by:StanleyLMW
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now