Convert() Function in SQL Server

Filed in SQLTags: , , ,

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

Sourabh Sharma (150 Posts)


Feedback

Comments

One Response to “Convert() Function in SQL Server”
  1. arun anand says:

    its really interesting wanna c more informations.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>