Convert() Function in SQL Server

The convert() function is used to convert an expression of one  specific data type to another type. Also this function can be used to represent the value of date/time type variable in different different format. As we will discuss later in this post we will see how we accomplish this task.



Systax:

CONVERT(data_type(length),expression,style)

data-type(length): It specifies the data type in which the value should be converted. It is the targeted data type.
expression: Specifies the value that has to be converted.
style: It specifies the format of the date/time.

The below table that what we styles are available to use inside the convert() function:

convert
There is another function Cast() that we used to convert data type. To learn more about Cast() Function click Here

admin (157 Posts)


Comment ( 1 )

  1. arun anandMarch 9, 2013 14 // Reply

    its really interesting wanna c more informations.

Leave a reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.