i need insert unique value and between 1 and 3000 sql serverhow to do it\?declare @st int=1declare @rn intwhile(@st <= 3000) begin set @rn= ABS(Checksum(NewId()) % 3000); set @st = @st+1; insert into HumanResourceSchema.Employee (EmpNo,EmpFname,EmpLname,DeptNo)values(@rn,'Smith','Jane','d1') endthe error say Violation of UNIQUE KEY constraint ''c3''. Cannot insert duplicate key in object ''HumanResourceSchema.Employee''. The duplicate key value is (<NULL>) 解决方案 这篇关于插入随机唯一值且介于1到3000个sql server之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-22 02:44