If I have an SQL table with all default columns (e.g. identity column + any number of columns all with default values), what is the SQL statement to insert a row with no explicit values given?
insert MyTable /* ( doh, no fields! ) */ -- values( doh, no values! )
What's the trick?
This is a part of the INSERT syntax
INSERT
INSERT INTO TableName DEFAULT VALUES
Read more here: https://docs.microsoft.com/en-us/sql/t-sql/statements/insert-transact-sql
2.1m questions
2.1m answers
60 comments
57.0k users