Sounds like what you are talking about is generating new rows, then number of which is based on a [count] column. To do this you can JOIN to a table of numbers (usually INTs from 0 to whatever the largest [count] value is. People use either a numbers function, a permanent numbers table, or even just a derived table or sub-query which results in a series of INTs. In this case I'll just use an existing table in the Master database as this table:use tempdbgoCreate table table1 (Code varchar(20), [Count] int)goCreate table table2 (Code varchar(20), Data varchar(20))goinsert table1 values('A1',3)insert table2select t.code ,'aa'from table1 tinner join master..spt_values n on n.type = 'P' and n.number < t.[count]select * from table2godrop table table1drop table table2OUTPUT:Code Data-------------------- --------------------A1 aaA1 aaA1 aaBe One with the OptimizerTG