insert unique value and between 1 and 3000 sql server
declare @st int=1 declare @rn int while(@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') end
Violation of UNIQUE KEY constraint 'c3'. Cannot insert duplicate key in object 'HumanResourceSchema.Employee'. The duplicate key value is (<NULL>)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)