Does SQL Server have a Date_Format function? All I found is a list of predefined DateFormat that I can choose from, like this

As I remember in MySQL (and PostgeSQL too?) you can define your Date Format:

DATE_FORMAT(now(),'&amp;m_%Y') --for 02_2012 etc.


Does SQL Server have the same thing? I see people have to write a function to do such thing, does it have a built-in one?



EDIT:

I just found the DatePart function. It can take Month as number, but always returns 1 digit, even I use  datePart(MM, getdate())
Not yet.

You need to use CONVERT with a style parameter or hack something together with DATEPART or DATENAME.

SQL Server 2012 will have the FORMAT function though that accepts a .NET Framework format string

Syntax:

FORMAT ( value, format [, culture ] )


Example Usage

SELECT FORMAT(getdate(), 'dd/MM/yyyy', 'en-US' ) 


You could always use CLR integration and create your own UDF that does the same thing for 2005 or 2008.