Tuesday, 10 September 2013

Add a timestamp to file name

Add a timestamp to file name

To avoid name collisions, I need to add a timestamp like extension to
files my server creates. I was thinking to something like yyyymmddhhss.
What is the efficient way to generate a string like '201309091725' (with
eventually more digits) ?
select cast( sysdatetime() as varchar) does include spaces, colons and
dots, making that unusable.

No comments:

Post a Comment