Tuesday, February 19, 2008

SQL server - formating with dates

To set a file with date behind e.g. YYYYMMDD , you can use the below
command in sql server

set @Filename = 'DailyHealthcheck_' + REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), '/', '') + '.html'

Working with SQL Server Date/Time Variables: Part Two - Displaying Dates and Times in Different Formats

http://www.databasejournal.com/features/mssql/article.php/2197931

No comments: