Does The FORMAT Function Still Suck For Performance in SQL Server?

preview_player
Показать описание


If you like what you see here, you'll love my advanced performance tuning training:
Рекомендации по теме
Комментарии
Автор

Another thing to remember is that Format returns an nvarchar(4000). Sometimes taking the left() or substring() can help.

AlonEvan
Автор

I'm surprised that Erik never pointed out why FORMAT is so expensive. It's because it does all of its work in the CLR whereas CONVERT is an honest SQL function (probably C).

FlaggedStar
Автор

Would you not be able to use the datepart() function to assemble the individual date parts required instead of format()?

jmshelton
Автор

I feel like I'm missing something, but why are you comparing CONVERT(date, ) which presumably returns a DATE with FORMAT which returns a string? Apples/Oranges?

stickman
Автор

Isn't the point of format to make something neat human readable? So it should never be needed on a non-human readable amount of rows really, but only in a final output to a human for stuff like drill-thru results file pdf exports where putting the formatting in the front-end might actually not make sense.

join shbcf.ru