Sql Server Format() function is very useful when you need to display values in different formats.
Usually when I needed to display any datetime value in different format, I used to convert the datetime to varchar using a format specifier.
Sql Server 2012 has a new function to solve this problem.
Syntax : (culture is optional)
FORMAT (value, format, culture)
Format() function returns nvarchar value or null.
You can use custom date time format strings
Here how it looks like when we format currency.

No comments:
Post a Comment