在插入数据时利用默认值
USE HrSystem
GO
ALTER TABLE Employees ADD InputDatetime datetime DEFAULT(getdate())
GO
USE HrSystem
GO
INSERT INTO Employees (Emp_Name,Sex,Title,IdCard,Wage,Dep_Id)
values('小李','男','职员','210123456789',2500,2)
GO
USE HrSystem
GO
ALTER TABLE Employees ADD InputDatetime datetime DEFAULT(getdate())
GO
USE HrSystem
GO
INSERT INTO Employees (Emp_Name,Sex,Title,IdCard,Wage,Dep_Id)
values('小李','男','职员','210123456789',2500,2)
GO