Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Unique Indexes
I'm supporting a database that has a Unique Index and yet that column has
duplicate values.  How can that happen?

Report this thread to moderator Post Follow-up to this message
Old Post
MichaelW
04-30-05 01:23 AM


Re: Unique Indexes
What kind of column is this index for (datatype, etc.)

From BOL:

Microsoft® SQL ServerT checks for duplicate values when the index is created
(if data already exists) and checks each time data is added with an INSERT
or UPDATE statement. If duplicate key values exist, the CREATE INDEX
statement is canceled and an error message giving the first duplicate is
returned. Multiple NULL values are considered duplicates when UNIQUE index
is created.

These values you identified must differ from each other in any way, perhaps
there are (trailing) spaces involved ?


HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---


"MichaelW" < MichaelW@discussions
.microsoft.com> schrieb im Newsbeitrag
news:87D6720D-206F-4AF3-95D9- FA42765DACAD@microso
ft.com...
> I'm supporting a database that has a Unique Index and yet that column has
> duplicate values.  How can that happen?



Report this thread to moderator Post Follow-up to this message
Old Post
Jens Süßmeyer
04-30-05 01:23 AM


Re: Unique Indexes
The column is varchar and is used for a usernames.  I was using bcp to move
data from tableA to tableB.  So there are 3 usernames that are very close in
naming using extended ascii characters like ë ê è.  I used the native opt
ion
for bcp and those 3 characters ended up as e e e in tableB making 3 username
s
the same.  So that's why the unique index creation was failing.


"Jens Süßmeyer" wrote:

> What kind of column is this index for (datatype, etc.)
>
> From BOL:
>
> Microsoft® SQL ServerT checks for duplicate values when the index is crea
ted
> (if data already exists) and checks each time data is added with an INSERT
> or UPDATE statement. If duplicate key values exist, the CREATE INDEX
> statement is canceled and an error message giving the first duplicate is
> returned. Multiple NULL values are considered duplicates when UNIQUE index
> is created.
>
> These values you identified must differ from each other in any way, perhap
s
> there are (trailing) spaces involved ?
>
>
> HTH, Jens Suessmeyer.
>
> ---
> http://www.sqlserver2005.de
> ---
>
>
> "MichaelW" < MichaelW@discussions
.microsoft.com> schrieb im Newsbeitrag
> news:87D6720D-206F-4AF3-95D9- FA42765DACAD@microso
ft.com... 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
MichaelW
04-30-05 01:23 AM


Re: Unique Indexes
Was it created with the IGNORE_DUP_KEY option?

--
Andrew J. Kelly  SQL MVP


"MichaelW" < MichaelW@discussions
.microsoft.com> wrote in message
news:87D6720D-206F-4AF3-95D9- FA42765DACAD@microso
ft.com...
> I'm supporting a database that has a Unique Index and yet that column has
> duplicate values.  How can that happen?



Report this thread to moderator Post Follow-up to this message
Old Post
Andrew J. Kelly
04-30-05 01:23 AM


Re: Unique Indexes
Yes I did, but that will only help you after an index is in place.  I was
adding indexes to the new table that already had data in it.

"Andrew J. Kelly" wrote:

> Was it created with the IGNORE_DUP_KEY option?
>
> --
> Andrew J. Kelly  SQL MVP
>
>
> "MichaelW" < MichaelW@discussions
.microsoft.com> wrote in message
> news:87D6720D-206F-4AF3-95D9- FA42765DACAD@microso
ft.com... 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
MichaelW
04-30-05 08:23 AM


Re: Unique Indexes
If you got a Accent Sensitive collation (_AS) for the database this
behaviour is ok for me, because characters (and index entries differ from
each other)

http://www.databasejournal.com/feat...cle.php/3302341

Try to change the coallation of the database or in detail for the specified
column to a Accent Sensitive format to see wheter that helps.


HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---



"MichaelW" < MichaelW@discussions
.microsoft.com> schrieb im Newsbeitrag
news:3406C072-F977-459B-9F80- 3CABB5568FE4@microso
ft.com...
> The column is varchar and is used for a usernames.  I was using bcp to
> move
> data from tableA to tableB.  So there are 3 usernames that are very close
> in
> naming using extended ascii characters like ë ê è.  I used the native
> option
> for bcp and those 3 characters ended up as e e e in tableB making 3
> usernames
> the same.  So that's why the unique index creation was failing.
>
>
> "Jens Süßmeyer" wrote:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Jens Süßmeyer
04-30-05 08:23 AM


Re: Unique Indexes
Thanks for the link.  I don't think it is a server collation issue.  I think
it is a bcp conversion problem.  Has anyone seen this issue with bcp before?
I will be running more tests in the morning.

"Jens Süßmeyer" wrote:

> If you got a Accent Sensitive collation (_AS) for the database this
> behaviour is ok for me, because characters (and index entries differ from
> each other)
>
> http://www.databasejournal.com/feat...cle.php/3302341
>
> Try to change the coallation of the database or in detail for the specifie
d
> column to a Accent Sensitive format to see wheter that helps.
>
>
> HTH, Jens Suessmeyer.
>
> ---
> http://www.sqlserver2005.de
> ---
>
>
>
> "MichaelW" < MichaelW@discussions
.microsoft.com> schrieb im Newsbeitrag
> news:3406C072-F977-459B-9F80- 3CABB5568FE4@microso
ft.com... 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
MichaelW
04-30-05 12:23 PM


Re: Unique Indexes
Is your issue to create index or to bcp the data out ?

bcp has serveral switches for pumping out native data, an example is -C, the
import routine depends in the data you have. Is it unicode or system native
?

-C codepage
Code page being used by the import file. Only relevant when the data
contains char, varchar, or text columns with character values greater than
127 or less than 32. Use the code page value ACP with ANSI ISO 1252 data,
RAW when no conversion should occur, OEM to use the client's default code
page, or type a specific code page value, such as 850.



HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---



"MichaelW" < MichaelW@discussions
.microsoft.com> schrieb im Newsbeitrag
news:52646E0E-99EA-43BB-BCE2- 449D5F6AA64E@microso
ft.com...
> Thanks for the link.  I don't think it is a server collation issue.  I
> think
> it is a bcp conversion problem.  Has anyone seen this issue with bcp
> before?
> I will be running more tests in the morning.
>
> "Jens Süßmeyer" wrote:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Jens Süßmeyer
04-30-05 12:23 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:45 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006