fuerteventura
asked on
Convert time to number in T-SQL
I'm sure this is easy - how do you convert the current date and time into a number in Transact SQL, taking into account split seconds? Quite a few digits if possible as i want to use it as an ID on an Audit table (not a unique ID though for obvious reasons!)- thanks for looking
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT REPLACE(CONVERT(VARCHAR, GETDATE() , 103),'/','')+
REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
on 4th February 2008 at 11:30 and 20 seconds and 30 milliseconds I need an id such as the following:
0402200811302030
Can anyone help me get that/ I presume a datepart function may be usefull? I will be awarding points to all of the above as all answer the original question, many thanks again