sql-server add tag
WrinkleFree (imported from SE)
If I create a table with an `identity` column as primary key, and all the other columns have default values, for example:

    create table rr
    (
        id int identity(1,1) primary key, 
        dt datetime default getdate()
    );
Top Answer
Martin Smith (imported from SE)
To insert a single row

    INSERT INTO RR DEFAULT VALUES;

It is possible to insert multiple rows of default values by (ab)using `MERGE`

    MERGE INTO RR
    USING (SELECT TOP 1000 *
           FROM   master..spt_values) T
    ON 1 = 0
    WHEN NOT MATCHED THEN
      INSERT
      DEFAULT VALUES; 

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.