SQL insert default value
- by Stan
Say if I have a table like
CREATE TABLE [Message] (
[MessageIdx] [int] IDENTITY (1, 1) NOT NULL ,
[Message] [varchar] (1024) COLLATE Latin1_General_CI_AS NOT NULL ,
[ValidUntil] [datetime] NULL ,
CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED
(
[MessageIdx]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
GO
I am trying to insert value without specify column names explicitly. Below statement causes error. How can I do that? Thanks.
set identity_insert caconfig..fxmessage on;
insert into message values (DEFAULT,'blah',DEFAULT);
set identity_insert caconfig..fxmessage off;