• Orlando Colamatteo (2/9/2016)


    The performance of FORMAT is very poor when used over large sets of data which is unfortunate because the syntax is more readable than any of the other methods available for work like this. This happens to be one place where I would use FORMAT **IF** your example is representative of how you need to use it, i.e. you want to get the format of the current date into a variable and use it over and over, like this:

    DECLARE @MMDDYYYY CHAR(8) = FORMAT(GETDATE(), 'MMddyyyy');

    SELECT @MMDDYYYY AS [@MMDDYYYY]

    If your intent is to format datetime data stored in a column then do not use FORMAT, use REPLACE with CONVERT as shown in your original post.

    nevermind...just noticed you're on SQL 2008

    Thank you very much for this information, it has not gone wasted as sometime this year we will be upgrading to 2012, so this is very helpful, appreciate it.

    Thanks

    Michael