FORMAT()
function syntax with an example in SQL Server
Introduction:
In my previous posts we have seen what is Transact-Sql in sql server and What are new top features of T-Sql in server. This is one of the best sql server interview Questions and answers. Watch more ASP.NET, C#.NET, Jquery, Sql Server, HTML5, HTML, CSS, JQUERY UI Interview questions from here.
Description:
·
This function returns a value
formatted with the specified format.
·
The function FORMAT () accepts 3 parameters.
The first parameter is the VALUE parameter where the date value or numeric
value is passed. The second parameter is the.NET Framework format string. The
format parameter is case sensitive. The third parameter is the culture.
This can be any culture supported by the .NET Framework.
Example:
DECLARE @d DATETIME = ‘01/06/2011’;
SELECT FORMAT ( @d, 'dd/MM/yyyy', 'en-US' )
Result:
06/01/2011
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.