Tuesday, February 14, 2012

dblib bulk copy ( empty string VS <NULL>)

I am trying to insert an empty string value using the bcp_functions without
getting the <NULL> indicator in the target column.
I am trying to preserve the state of a source column which may contain a
null, empty string or a string. Any clues?
Thanks.Hi
If the column is missing then you it will have a NULL value, you can change
the column definition so that it is not null with an empty string as a
default. Alternatively you can use the ISNULL() or COALESCE() functions to
return a different value for NULLS when you retrieve the data.
John
"Chee" wrote:

> I am trying to insert an empty string value using the bcp_functions withou
t
> getting the <NULL> indicator in the target column.
> I am trying to preserve the state of a source column which may contain a
> null, empty string or a string. Any clues?
> Thanks.
>
>|||Hi John
Thanks for the information.
I tried the default value for the column - ('') for an empty string. It
seems to work until you check the value in the column through enterprise
manager and you will notice that a space has actually been inserted. Any
clue?
thanks, Chee
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:9BC3D9B3-A790-4FCE-A172-8C8C73F2D05D@.microsoft.com...
> Hi
> If the column is missing then you it will have a NULL value, you can
change
> the column definition so that it is not null with an empty string as a
> default. Alternatively you can use the ISNULL() or COALESCE() functions to
> return a different value for NULLS when you retrieve the data.
> John
> "Chee" wrote:
>
without|||On Mon, 25 Apr 2005 18:07:32 -0700, Chee wrote:

>Hi John
>Thanks for the information.
>I tried the default value for the column - ('') for an empty string. It
>seems to work until you check the value in the column through enterprise
>manager and you will notice that a space has actually been inserted. Any
>clue?
>thanks, Chee
Hi CHee,
What is the datatype for the column? Can you copy the complete CREATE
TABLE statement (including all constraints, properties, defaults, etc). If
the table has dozens of columns, then pease omit the irrelevant ones.
Also, can you copy the code used to insert dataa in the table?
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment