HamoriZ
HamoriZ

Reputation: 2438

MS SQL unique key - bug or feature?

I have a table in MS SQL where I have a TERMINAL varchar(50) column and I have a unique key on it. I get a UK key violation exception when I try to insert record 'HOST1' and then 'HOST1 '. Why MS sql handles these two strings as they would be the same?

Thanks Z

Upvotes: 3

Views: 191

Answers (1)

James Culshaw
James Culshaw

Reputation: 1057

I believe that MS SQL strips the white space at the end for VARCHAR.

Upvotes: 5

Related Questions