• Danny Ocean (5/2/2013)


    Most of people don't know about it because it's not in use in any real scenario. I never use this kind of table in production environment, But i knew it due to someone ask me about it earlier.

    Anyway, thanks for question.:-)

    A real (especially in old release of sqlserver) scenario is a TALLY table.

    [sql]

    INSERT INTO TableA DEFAULT VALUES

    GO 10000

    [/sql]

    Another way to insert values in Table A is:

    [sql]

    SET IDENTITY_INSERT TableA ON

    INSERT INTO TableA SELECT TOP 10000 ROW_NUMBER() OVER (ORDER BY A.object_id) FROM sys.objects A, sys.objects B

    SET IDENTITY_INSERT TableA OFF

    [/sql]