Skip to Content.
Sympa Menu

freetds - Re: [freetds] freebcp out from MS SQL Server drops spaces [NC]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <james.k.lowden AT alliancebernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] freebcp out from MS SQL Server drops spaces [NC]
  • Date: Fri, 10 Jul 2009 11:31:02 -0400

Frediano Ziglio reported:
>
> I'm doing some test...
> - NULLs become empty strings in both varchar and char.
> - empty strings became a single NUL character for varchar and all
> spaces for char
> - varchar are not padded but keep spaces at the end
> - char are padded with spaces

Nullable CHAR are not padded on output, and should be:

=== FreeTDS ===
1> create table ##char( c char(16) null)
insert ##char values ('a')
insert ##char values ('pad ')
2> go
(1 row affected)
(1 row affected)
[2]+ Stopped sqsh

$ freebcp '##char' out c -c -S$S -U$U -P$P

Starting copy...
2 rows copied.
$ hexdump -C c
00000000 61 0a 70 61 64 0a |a.pad.|
00000006
=== SDTeerF ===

=== Microsoft ===
$ bcp ##char out c -c -T -S mpquant

Starting copy...

2 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1

$ perl -pe "s/ /./g" c
a...............
pad.............
=== tfosorciM ===

--jkl
-----------------------------------------------------------------------------------
The information contained in the linked e-mail transmission and any
attachments may be privileged and confidential and is intended only for
the use of the person(s) named in the linked e-mail transmission. If you
are not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you should not
review, disseminate, distribute or duplicate this e-mail transmission or
any attachments. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. We do not accept account orders and/or instructions
related to AllianceBernstein products or services by e-mail, and
therefore will not be responsible for carrying out such orders and/or
instructions. The linked e-mail transmission and any attachments are
provided for informational purposes only and should not be construed in
any manner as any solicitation or offer to buy or sell any investment
opportunities or any related financial instruments and should not be
construed in any manner as a public offer of any investment
opportunities or any related financial instruments. If you, as the
intended recipient of the linked e-mail transmission, the purpose of
which is to inform and update our clients, prospects and consultants of
developments relating to our services and products, would not like to
receive further e-mail correspondence from the sender, please "reply"
to the sender indicating your wishes. Although we attempt to sweep
e-mail and attachments for viruses, we will not be liable for any
damages arising from the alteration of the contents of this linked e-mail
transmission and any attachments by a third party or as a result of any
virus being passed on. Please note: Trading instructions sent
electronically to Bernstein shall not be deemed accepted until a
representative of Bernstein acknowledges receipt electronically or by
telephone. Comments in the linked e-mail transmission and any
attachments are part of a larger body of investment analysis. For our
research reports, which contain information that may be used to
support investment decisions, and disclosures, see our website at
www.bernsteinresearch.com.





Archive powered by MHonArc 2.6.24.

Top of Page