views:

262

answers:

1

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 timestamp.

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?

+1  A: 

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.

gd047