469,579 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

problem about right aligned data when using bcp


there are one table with a column with 16 varchar, eg. ________1245678( _
stands for space.).the database size is 15 MB.

when using bcp,

right-aligned data will be display.

Can i change it to left-aligned, eg. 12345678________?

i have use the store procedure with "ltrim" to cut off the spacing, Can i use
another methods to change it??

Thx
Jul 23 '05 #1
2 2135
If you want to use bcp.exe, then you could use "queryout" instead of
simply "out" - that would allow you to use a stored proc or a query to
trim the data and add spaces for padding or whatever. Another option
would be using a DTS package with a column transformation to do the
trimming/padding, but that's a more complex solution, so if bcp will do
what you want it's probably easier to use it.

Simon

Jul 23 '05 #2
esther s via SQLMonster.com (fo***@SQLMonster.com) writes:
there are one table with a column with 16 varchar, eg. ________1245678( _
stands for space.).the database size is 15 MB.

when using bcp,

right-aligned data will be display.

Can i change it to left-aligned, eg. 12345678________?

i have use the store procedure with "ltrim" to cut off the spacing, Can
i use another methods to change it??


It isn't clear me, do you want to strip the leading spaces when bulking
out, or do you get leading spaces when you load a file? In the latter
case, it would help to have the table definition, and a sample of the
data file.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Marek Mand | last post: by
5 posts views Thread by Chris Beall | last post: by
reply views Thread by PJ | last post: by
3 posts views Thread by Muhammad Farooq-i-Azam | last post: by
6 posts views Thread by arne.muller | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.