Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime values
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01521321
Message ID:
01521340
Views:
40
>>>>Hi
>>>>
>>>>I'm processing some csv files and I want to move the processed file to another location and rename it with a datetime string
>>>>
>>>>yyymmddhhmmss
>>>>
>>>>anyone know the easiest way to return that string from GETDATE()
>>>>
>>>>Thanks
>>>>
>>>>Nick
>>>
>>>CAST(REPLACE(REPLACE(REPLACE(convert(CHAR(19),GETDATE(),126 ),'-',''),'T',''),':','') AS CHAR(14))
>>
>>T-SQL really makes you jump through hoops sometimes, doesn't it? Even getting the date portion of a datetime is verbose and ugly. It mystifies that it hasn't been simplified by now.
>
>MSSQL and T-SQL is not Oracle and PL/SQL ;-)
>

True. Most of my time is spent working with T-SQL so it's a moot point for me. In any case I am encouraged by Sergey's reply about the FORMAT() command in SS 2012.

Out of curiosity, what is your favorite DBMS / data language, and why?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform