How to insert data into a package?

In MySQL, I could hide these statements to insert 5 rows in one snapshot:

CREATE TABLE t (id int primary key auto_increment)
INSERT INTO t VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT)

How can I do the same in MS SQL Server?

PS The reason the proposed duplicate does not solve the problem is because it contains tables with non-identical columns. My table contains only a column of identifiers.

+4
source share
1 answer

If you have this definition:

CREATE TABLE t (id int IDENTITY(1,1) PRIMARY KEY)

Then you can do this:

INSERT t DEFAULT VALUES
INSERT t DEFAULT VALUES
INSERT t DEFAULT VALUES
INSERT t DEFAULT VALUES
INSERT t DEFAULT VALUES
+3
source

Source: https://habr.com/ru/post/1621070/


All Articles