HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What is the corresponding MySQL TimeStamp in MS SQL Server?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thewhatsqlmysqltimestampservercorresponding

Problem

I need a timestamp to be created automatically when I insert information in a table. mySQL has TimeStamp but MS SQL Server TimeStamp doesn’t correspond mySQL. Is there any other way around?

Solution

From MSDN: "The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type."

To be able to have a date automatically inserted in your table, you should have a column of type datetime with a default value of getdate() - the system function that shows the current date of the system.

Context

StackExchange Database Administrators Q#889, answer score: 7

Revisions (0)

No revisions yet.