Advertisement
yurakmv26

Untitled

Dec 8th, 2020
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. --create database TestKeyLookUp
  2.  
  3. use TestKeyLookUp
  4. go
  5.  
  6. drop table if exists dbo.Test
  7. create table dbo.Test
  8. (
  9. Column1 int not null,
  10. Col1 int not null,
  11. NCIColumn int not null,
  12. IncludedCol int not null
  13. )
  14. go
  15.  
  16. create unique clustered index IDX_CI
  17. on dbo.Test(Column1)
  18. go
  19.  
  20. create unique nonclustered index IDX_NCI
  21. on dbo.Test(NCIColumn)
  22. include(IncludedCol)
  23. go
  24.  
  25. ;with N1(C) as (select 0 union all select 0) -- 2 rows
  26. ,N2(C) as (select 0 from N1 as T1 cross join N1 as T2) -- 4 rows
  27. ,N3(C) as (select 0 from N2 as T1 cross join N2 as T2) -- 16 rows
  28. ,N4(C) as (select 0 from N3 as T1 cross join N3 as T2) -- 256 rows
  29. ,IDs(ID) as (select row_number() over (order by (select null)) from N4)
  30. insert into dbo.Test(Column1, Col1, NCIColumn, IncludedCol)
  31. select ID, ID, ID, ID
  32. from IDs;
  33. go
  34.  
  35.  
  36. -- 1 сессия
  37. declare
  38. @I int
  39.  
  40. select @I = 1
  41.  
  42. while 1 = 1
  43. begin
  44. update dbo.Test
  45. set IncludedCol = @I
  46. where Column1 = 10;
  47.  
  48. select @I = @I + 1;
  49. end
  50. go
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement