开发者

How to INSERT INTO table DEFAULT VALUES

开发者 https://www.devze.com 2022-12-19 03:19 出处:网络
When you want to insert default values into a table, some databases allow this syntax: INSERT INTO table DEFAULT VALUES;

When you want to insert default values into a table, some databases allow this syntax:

INSERT INTO table DEFAULT VALUES;

ASE does not support this.

Using:

INSERT INTO table (col2, col3) 
VALUES (DEFAULT, DEFAULT)

and skipping the identity column works for columns with constant default values, but not for computed columns including times开发者_Go百科tamp.

Introspecting the table for a column with a constant default and then just specifying DEFAULT for that column would work, unless it's a table with only an identity and computed columns, but no one is likely to use such tables.

Is there an easier way?


Skip columns with default values from the insert statement. If a default value exists for the skipped column (or user-defined datatype of the column), it is entered.

0

精彩评论

暂无评论...
验证码 换一张
取 消