Thursday, December 31, 2015

Make SQL select statement to get same row multiple times

If I get your meaning then a very simple way is to cross join on a derived query on a table with more than 1000 rows in it and put a top 1000 on that. This would duplicate your results 1000 times.



SELECT
    MyTable.*
FROM
    MyTable
CROSS JOIN
(
    SELECT TOP 1000
        *
    FROM
        sysobjects
) [BigTable]
WHERE
    MyTable.ID = 1234



 

No comments:

Post a Comment