Sql Server - Index on nvarchar field

前端 未结 3 1349
暗喜
暗喜 2021-02-07 11:25

What is the good approach to keep a nvarchar field unique. I have a field which is storing URLs of MP3 files. The URL length can be anything from 10 characters to 4

3条回答
  •  广开言路
    2021-02-07 12:15

    You can use a hash function (although theoretically it doesn't guarantee that two different titles will have different hashes, but should be good enough: MD5 Collisions) and then apply the index on that column.

    MD5 in SQL Server

提交回复
热议问题