Mega Code Archive

 
Categories / MSSQL Tutorial / Transact SQL
 

Using the INSERT DEFAULT VALUES Statement

6>  CREATE TABLE MyTable( 7>   ID           int          NULL IDENTITY (1, 1), 8>   EntryDate    datetime     NULL DEFAULT (GETDATE ()), 9>   Description  varchar (20) NULL 10> ) 11> GO Msg 8147, Level 16, State 1, Server J\SQLEXPRESS, Line 6 Could not create IDENTITY attribute on nullable column 'ID', table 'MyTable'. 1> INSERT MyTable DEFAULT VALUES 2> 3> drop table MyTable 4> GO Msg 208, Level 16, State 1, Server J\SQLEXPRESS, Line 1 Invalid object name 'MyTable'. 1>