Created
March 11, 2013 23:01
-
-
Save markmo/5138724 to your computer and use it in GitHub Desktop.
Convert integer key to datetime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONVERT(DATETIME, CONVERT(VARCHAR, DateKey) + ' ' + | |
SUBSTRING(RIGHT('000000' + CONVERT(VARCHAR, DateKey), 6), 1, 2) + ':' + | |
SUBSTRING(RIGHT('000000' + CONVERT(VARCHAR, TimeKey), 6), 3, 2) + ':' + | |
SUBSTRING(RIGHT('000000' + CONVERT(VARCHAR, TimeKey), 6), 5, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment