Fill Dataset to 10 Multipliers


  
 
   
  
create table test (id int, col1 int)

insert into test values(1,1),(2,2),(3,3),(4,4), (5,1),(6,2),(7,3),(8,4),(9,1),(10,2)
,(11,3),(12,4),(13,3),(14,4)
 

declare @cnt int
select @cnt=count(*) from test

--Select @cnt%10

;with mycte as (
select *  from test
union all
select 999,9 from 
(values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10))   d(n)
where n<=10 - @cnt%10  and @cnt%10<>0
)
 
Select *  from mycte 

drop table test

 
 

 
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s