I'm loading a key values into a database and two may be identical except for maybe 1 or 2 trailing spaces. This causes a unique constraint error because for some reason it's trimming the string values when checking the unique contstraint

I can clearly see in the dataset the string has spaces on the end. I know this is the exact problem because if I append a letter after one of them the exception goes away

Why does it trim the string when validating the Primary Key unique constraint

Thanks
Jeff

RE: Primary Key of string values (trims spaces from the end of strings) causes unique violation by anonymous

anonymous
Thu Feb 19 15:21:06 CST 2004

Instead of database into a table in a ADO.NET dataset.

Re: Primary Key of string values (trims spaces from the end of strings) causes unique violation by bruce

bruce
Thu Feb 19 19:43:04 CST 2004

ansi sql ignores trailing blanks on string compares



"Jeff Flowerday" <anonymous@discussions.microsoft.com> wrote in message
news:9A7F47C7-44CC-4980-B0E5-4EC89EEE798A@microsoft.com...
> I'm loading a key values into a database and two may be identical except
for maybe 1 or 2 trailing spaces. This causes a unique constraint error
because for some reason it's trimming the string values when checking the
unique contstraint.
>
> I can clearly see in the dataset the string has spaces on the end. I
know this is the exact problem because if I append a letter after one of
them the exception goes away.
>
> Why does it trim the string when validating the Primary Key unique
constraint?
>
> Thanks,
> Jeff



Re: Primary Key of string values (trims spaces from the end of strings) causes unique violation by anonymous

anonymous
Fri Feb 20 09:31:05 CST 2004

I understand that ANSI SQL ignores trailing blanks. Does that mean in an ADO.NET dataset that a Primary Key on a datatable is going to do the same and how to make it not do that? The data is original coming from Oracle and it allows for trailing spaces and considers it unique

Thanks
Jeff