1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
create table test_check_index
(
id int identity primary key,
type tinyint not null,
debut datetime2 not null,
fin datetime2 not null,
check (type in (1, 2, 3)),
check (debut < fin)
);
go
create index ix_date on test_check_index(fin);
go
declare @i int;
declare @date datetime2;
set @i = 0;
while @i < 10000000
begin
select @i = @i + 1, @date = DATEADD(day, rand() * -5000, GETDATE());
insert into test_check_index (type, debut, fin) values (cast(RAND() * 3 as tinyint) + 1, @date, DATEADD(day, RAND() * 6000, @date));
end;
go |
Partager