In MySQL, I could fire off these statements to insert 5 rows in one shot:
CREATE TABLE t (id int primary key auto_increment)
INSERT INTO t VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT)
How can I do the same thing in MS SQL Server?
P.S. The reason that the suggested duplicate doesn't solve the problem is that it has tables with non-identity columns. My Table only has an identity column.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With