Link to home
Start Free TrialLog in
Avatar of ComfortablyNumb
ComfortablyNumbFlag for United Kingdom of Great Britain and Northern Ireland

asked on

TSQL Insert With Just Default Values

Hi Experts,

Don't know if this is possible. Have a table with just an ID and datetime so both are set with defaults.

CREATE TABLE [dbo].[tb_ErrorLog](
	[errorLogID] [int] IDENTITY(1,1) NOT NULL,
	[errorLogDate] [datetime] NOT NULL,
 CONSTRAINT [PK_tb_ErrorLog] PRIMARY KEY CLUSTERED 
(
	[errorLogID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tb_ErrorLog] ADD  CONSTRAINT [DF_tb_ErrorLog_errorLogDate]  DEFAULT (getdate()) FOR [errorLogDate]
GO

Open in new window


All I want to do is to increment the table with a record every time a particular web page is reached.

So how do you write the INSERT statement without any passed values?

Regs,
Numb
Avatar of Asim Nazir
Asim Nazir
Flag of Pakistan image

INSERT INTO [SS].[dbo].[tb_ErrorLog]
           ([errorLogDate])
     VALUES
           (default)
ASKER CERTIFIED SOLUTION
Avatar of Asim Nazir
Asim Nazir
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ComfortablyNumb

ASKER

As simple as that! cheers