|
Home > Archive > Microsoft SQL Server forum > July 2005 > problem about right aligned data when using bcp
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
problem about right aligned data when using bcp
|
|
| esther s via SQLMonster.com 2005-07-19, 3:23 am |
|
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
| |
| Simon Hayes 2005-07-19, 3:23 am |
| 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
| |
| Erland Sommarskog 2005-07-19, 8:24 pm |
| esther s via webservertalk.com (forum@webservertalk
.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, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
|
|
|
|
|