use tempdb go Set nocount on go create table #t1(c1 char(4) primary key, c2 char(300)) go insert into #t1 values (replicate(char(170),4),replicate(char(0),300)) Update #t1 set c2 = STUFF(c2,1,8,replicate(CHAR(170),8)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(c2,9,291,replicate(CHAR(160),291)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(c2,9,256,replicate(replicate(CHAR(171),8) + replicate(CHAR(187),8),16)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(c2,25,224,replicate(CHAR(171)+REPLICATE(char(160),14)+CHAR(187),14)) where c1=replicate(char(170),4) Declare @i int = 1, @m int = 5, @s int While @i<@m begin set @s=(RAND() * 100)+ 26 if (@s - 1) % 8 !=0 AND (@s % 8 !=0) begin Update #t1 set c2 = STUFF(c2,@s,1,CHAR(39)) where c1=replicate(char(170),4) set @i+=1 end end Update #t1 set c2 = STUFF(c2,201,48,replicate(CHAR(171)+REPLICATE(char(59),14)+CHAR(187),3)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(c2,64,3,CHAR(45)+char(215)+CHAR(45)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(c2,48,3,CHAR(92) + CHAR(124) + CHAR(47)),80,3,CHAR(47) +char(124)+CHAR(92) ) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(STUFF(STUFF(c2,219,1,CHAR(77)),220,1,CHAR(69)),221,2,replicate(CHAR(82),2)),223,1,CHAR(89)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(STUFF(STUFF(c2,225,1,CHAR(88)),226,1,CHAR(77)),227,1,CHAR(65)),228,1,CHAR(83)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(STUFF(STUFF(c2,236,1,CHAR(72)),237,1,CHAR(65)),238,2,replicate(CHAR(80),2)),240,1,CHAR(89)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(STUFF(STUFF(c2,243,1,CHAR(50)),244,1,CHAR(48)),245,1,CHAR(49)),246,1,CHAR(50)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF((STUFF(c2,192,3,Replicate(CHAR(35),3))),176,3,Replicate(CHAR(35),3)) where c1=replicate(char(170),4) Update #t1 set c2 = STUFF(STUFF(c2,156,11,CHAR(60) + REPLICATE(CHAR(161),9)+ CHAR(62)),141,9,CHAR(47) + REPLICATE(CHAR(161),7)+ CHAR(92)) Update #t1 set c2 = STUFF(STUFF(c2,126,7,CHAR(47) + REPLICATE(CHAR(161),5)+ CHAR(92)),111,5,CHAR(47) + REPLICATE(CHAR(161),3)+ CHAR(92)) Update #t1 set c2 = STUFF(STUFF(STUFF(STUFF(c2,97,1,CHAR(65)),128,1,CHAR(212)),146,1,CHAR(212)),158,1,CHAR(212)) Update #t1 set c2 = STUFF(c2,260,2,CHAR(68)+CHAR(71)) dbcc traceon (3604) --dbcc page( declare @db int = db_id(), @File int, @Page int select @File = Convert (int, SubString (au.first_page, 6, 1) + SubString (au.first_page, 5, 1)) , @Page = Convert (int, SubString (au.first_page, 4, 1) + SubString (au.first_page, 3, 1) + SubString (au.first_page, 2, 1) + SubString (au.first_page, 1, 1)) From sys.indexes i Join sys.partitions p On i.object_id = p.object_id And i.index_id = p.index_id Join sys.system_internals_allocation_units au On p.hobt_id = au.container_id Where p.object_id = object_id('#t1') dbcc page (@db,@File,@Page,1) drop table #t1