tags:

views:

38

answers:

2

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?

A: 

you can use the DEFAULT keyword

Joseph
+7  A: 

This is a part of the INSERT syntax

INSERT TableName DEFAULT VALUES

Read more here

http://msdn.microsoft.com/en-us/library/aa933206%28SQL.80%29.aspx

Raj More
Thanks, great response time! :)
Shaul