use current date as default value for a column
Add a default constraint with the GETDATE() function as value.
ALTER TABLE myTable
ADD CONSTRAINT CONSTRAINT_NAME
DEFAULT GETDATE() FOR myColumn
CREATE TABLE Orders(
O_Id int NOT NULL,
OrderNo int NOT NULL,
P_Id int,
OrderDate date DEFAULT GETDATE() // you can set default constraints while creating the table
)
You can use:
Insert into Event(Description,Date) values('teste', GETDATE());
Also, you can change your table so that 'Date' has a default, "GETDATE()"
Select Table Column Name where you want to get default value of Current date
ALTER TABLE
[dbo].[Table_Name]
ADD CONSTRAINT [Constraint_Name]
DEFAULT (getdate()) FOR [Column_Name]
Alter Table Query
Alter TABLE [dbo].[Table_Name](
[PDate] [datetime] Default GetDate())