Our application has the following table definition:
CREATE TABLE [dbo].[Phrase] (
[PhraseId] UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
[English] NVARCHAR (250) NOT NULL,
[EnglishHash] AS (CONVERT([bigint],hashbytes('md5',[English])%(5)+(5))) PERSISTED,
PRIMARY KEY CLUSTERED ([PhraseId] ASC)
);
The goal was for the EnglishHash column to be either 0,1,2,3,4,5,6,7,8 or 9
However, it gives only values: 1,2,3,4,5,6,7,8 or 9
Can someone help explain how I can change this to give values 0-9 inclusive?
Please note that I tried Sandip's suggestion. This gives me a distribution, but over 11,000 records distribution is not what I expected:
0 593
9 652
3 1324
6 1253
7 1293
1 1932
4 1325
5 1282
2 1295
8 635
Alan2 source
share