SQL snippets: Difference between revisions

From Celeste@Hoppinglife
Jump to navigation Jump to search
Created page with "<syntaxhighlight> with randowvalues as( select 1 id, CAST(RAND(CHECKSUM(NEWID()))*100 as int) randomnumber union all select id + 1, CAST(RAND(CHECK..."
 
No edit summary
 
Line 11: Line 11:
   
   
select * from randowvalues OPTION(MAXRECURSION 0);
select * from randowvalues OPTION(MAXRECURSION 0);
</syntaxhighlight>
<syntaxhighlight>
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 17:29, 16 June 2021

with randowvalues
    as(
       select 1 id, CAST(RAND(CHECKSUM(NEWID()))*100 as int) randomnumber
        union  all
        select id + 1, CAST(RAND(CHECKSUM(NEWID()))*100 as int) randomnumber
        from randowvalues
        where 
          id < 1000
      )
 
select * from randowvalues OPTION(MAXRECURSION 0);