Convert DateTime To TimeStamp
Posted on : 19-04-2012 | By : Devi Prasad | In : SQL Server Basics
0

How to Convert DateTime To TimeStamp?
Using CAST(DateTime AS TIMESTAMP).
Below query shows how you can convert datetime to timestamp.
[sql]
DECLARE @DateTimeVariable DATETIME
SELECT @DateTimeVariable = GETDATE()
SELECT @DateTimeVariable AS DateTimeValue,
CAST(@DateTimeVariable AS TIMESTAMP) AS DateTimeConvertedToTimestampCAST
–Alternate Approach
SELECT @DateTimeVariable AS DateTimeValue,
CONVERT(TIMESTAMP, @DateTimeVariable ) AS DateTimeConvertedToTimestampCONVERT
[/sql]
Reference : Devi Prasad (sqlserverlearner.com)
Do you like my blog?
If you liked reading this blog, please help spread the word by sharing this blog with your friends.
Need Help On SQL Server?
Cannot Find Solution to your problem (or) If you are looking for some help on SQL Server. Dont worry Click Here to Post your question and solve your issue.

Tags: convert datetime to timestamp sql, convert datetime to timestamp sql server 2005, convert datetime to timestamp sql server 2008, convert datetime to timestamp sql server 2012, how to convert Convert DateTime To TimeStamp, how to convert Convert DateTime To TimeStamp in sql server, t sql convert datetime to timestamp, tsql convert datetime to timestamp