Solved

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

Posted on 2009-03-30
5
555 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
ID: 24017145
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
ID: 24017602
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
ID: 24017966
I wasn't aware that bcp is going to be replaced. Where have you seen that?
0
 
LVL 22

Expert Comment

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

Author Comment

by:StanleyLMW
ID: 24019033
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

27 Experts available now in Live!

Get 1:1 Help Now