Most of the transactional tables generally do require to have a column with DEFAULT value as current date time to identify when the transaction had took place. To accomplish this, in CREATE TABLE statement you can use GETDATE() function or CURRENT_TIMESTAMP (ANSI SQL equivalent to GETDATE function) as DEFAULT. However there is no difference in output.
CREATE TABLE Employee(
empID BIGINT PRIMARY KEY,
EName VARCHAR(40) NOT NULL,
Application_Date SMALLDATETIME DEFAULT CURRENT_TIMESTAMP,
Reporting_Date SMALLDATETIME DEFAULT GETDATE(),
Relieved_Date SMALLDATETIME DEFAULT ’12/31/2010′, — mmddyyyy
Address VARCHAR(20) NULL)
INSERT INTO Employee(empID, Ename, Address) Values (1001, ‘Catherin’, ‘NewYork’)
SELECT * FROM Employee
Excellent, these are really useful articles for the database guys.hope u will post many more.
I spend a lot of time writing blog posts and frequently forget to express gratitude to my followers. Your feedback is really valuable to me. Thanks a lot.