-1

1)I have the following query

select CRESTACode,Latitude,Longitude   from airgeography..tgeography where countryname in (
'St. Maarten') and crestacode is not Null 

Result:

CRESTACode  Latitude    Longitude
6           18.035187    -63.076599

How do I repeat this data multiple times to get 3000 rows of same data in a table ?

Robert
  • 25,425
  • 8
  • 67
  • 81
VASISTA
  • 33
  • 1
  • 6

1 Answers1

0

although it could be expensive:

DECLARE @InsertNum INT 
SET @insertnum = 3000

select CRESTACode,Latitude,Longitude   
INTO #tablex
from airgeography..tgeography 
where countryname in ('St. Maarten') 
  and crestacode is not Null 

WHILE (@InsertNum <> 0 )
    BEGIN 
        INSERT INTO #Tablex 
        SELECT CRESTACode,Latitude,Longitude 
        FROM Tablex;

        SET @insertNum = @InserTNum - 1
        Print @InsertNum
    END 

SELECT * FROM #tablex
Suing
  • 465
  • 4
  • 9