Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Duplicate Values for Primary Key???

Author  Topic 

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2006-08-08 : 09:36:17
Not sure what I am missing or how to determine whats different, but it appears I can insert

QDC-MPP as one value in a primary key
and
QDC-MPP as another value,

one value was typed in, the other value was copied/pasted in, what am i missing, how do i tell whats really different? when i try to type in the value QDC-MPP after its already in the table i get the error, when i paste it, i dont???

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-08 : 09:52:11
is there any unprintable code some where in the value ? Or is it the value is of different case and your table is case sensitive ?


KH

Go to Top of Page

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2006-08-08 : 11:03:40
Thats a great question, I can tell you that the table isnt case sensitive, and am not sure how to look for the unprintable code? Any help would be greatly appreciated
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2006-08-08 : 11:44:09
Wild guess: the thing that looks like a hyphen is a different character in each.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-08 : 11:51:26
quote:
Originally posted by duhaas

Thats a great question, I can tell you that the table isnt case sensitive, and am not sure how to look for the unprintable code? Any help would be greatly appreciated



select
a.MyKey,
-- Convert Key to binary to see actual characters.
MyKeyBinary = convert(varbinary(100),a.MyKey)
from
MyTable a
where
a.MyKey like '%QDC%MPP%'
order by
a.MyKey


CODO ERGO SUM
Go to Top of Page

duhaas
Constraint Violating Yak Guru

310 Posts

Posted - 2006-08-08 : 13:14:25
you da man!
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-08-10 : 09:04:27
can't we convert binary data into another datatype. i.e. in varchar etc.

e.g.

Select Convert(VarBinary(1000), 'SQL')

o/p
--------
0x53514C

now i want to do...

Select Convert(VarChar(1000), '0x53514C')
o/p
--------
0x53514C

required o/p
--------
SQL

it returns the same value. how can i get o/p of binavry values to characters or another datatype?

thank in advance,
Mahesh
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-08-10 : 09:12:02
quote:
Originally posted by mahesh_bote

can't we convert binary data into another datatype. i.e. in varchar etc.

e.g.

Select Convert(VarBinary(1000), 'SQL')

o/p
--------
0x53514C

now i want to do...

Select Convert(VarChar(1000), '0x53514C')
o/p
--------
0x53514C

required o/p
--------
SQL

it returns the same value. how can i get o/p of binavry values to characters or another datatype?

thank in advance,
Mahesh




Sure...

just remove the quotes around the hex value...like this

Select Convert(VarChar(1000), 0x53514C)



Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-08-10 : 09:19:13
ZAKKAS
Go to Top of Page
   

- Advertisement -