In SQL Server how do I format getdate() output into YYYYMMDDHHmmSS where HH is 24 hour format?
getdate()
YYYYMMDDHHmmSS
HH
I\'ve got the YYYYMMDD
YYYYMMDD
Just for anyone searching for this functionality that has SQL Server 2012 you can use the FORMAT function:
SELECT FORMAT ( GETDATE(), 'yyyyMMddHHmmss') AS 'Custom DateTime'
This allows any .NET format strings making it a useful new addition.