Sorry for the OT but I wonder if anyone has played with MS SQL Server’s checksum function, I’m having an issue with a column of Datetime or Date data type, see below.
– DDL
create table Customer
(
CustomerID int not null primary key,
CustomerName varchar(80) not null,
CustomerPhone varchar(80) not null,
SalesLeadID int not null,
FieldOfDate date not null,
CustomerCheckSum int not null,
constraint CustomerCheckSum
check (checksum(CustomerID,FieldOfDate) = CustomerCheckSum)
);
– DML, it generated illogical complaint, failed to insert
insert into Customer
values (31, 'John Doe', '555-555-5555', 15,'2017-12-14',CHECKSUM(31,'2017-12-14'));
No, it didn’t work, I tried it before; also, the value of ‘2017-12-14’ for a date happens to be {today}, so, CAST the value to DATE would be more appropriate. Thanks tho.
That’s not the point. The point is that if one value is calculated on a Date object and the other is calculated on a String, then they will not be equal.
Yeah, good point. So, now, how do we know what data type does each of the following use? checksum(CustomerID,FieldOfDate) during the table creation process?