Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --create database TestKeyLookUp
- use TestKeyLookUp
- go
- drop table if exists dbo.Test
- create table dbo.Test
- (
- Column1 int not null,
- Col1 int not null,
- NCIColumn int not null,
- IncludedCol int not null
- )
- go
- create unique clustered index IDX_CI
- on dbo.Test(Column1)
- go
- create unique nonclustered index IDX_NCI
- on dbo.Test(NCIColumn)
- include(IncludedCol)
- go
- ;with N1(C) as (select 0 union all select 0) -- 2 rows
- ,N2(C) as (select 0 from N1 as T1 cross join N1 as T2) -- 4 rows
- ,N3(C) as (select 0 from N2 as T1 cross join N2 as T2) -- 16 rows
- ,N4(C) as (select 0 from N3 as T1 cross join N3 as T2) -- 256 rows
- ,IDs(ID) as (select row_number() over (order by (select null)) from N4)
- insert into dbo.Test(Column1, Col1, NCIColumn, IncludedCol)
- select ID, ID, ID, ID
- from IDs;
- go
- -- 1 сессия
- declare
- @I int
- select @I = 1
- while 1 = 1
- begin
- update dbo.Test
- set IncludedCol = @I
- where Column1 = 10;
- select @I = @I + 1;
- end
- go
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement