Learning Hub..!

Prabhakaran J – Blog

MS SQL

SQL Server CONVERT() Function

Convert() function used to convert one data type to another datatype, be used to display date/time data in various formats

Syntax

-- CONVERT Syntax:  
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )  

Arguments:

data_type | Refer the which datatype what to be convert.

( length ) | Refer the length of the new data type.

expression | Refer the source datatype which one you want convert.

style | Refer the specifies how the CONVERT function will translate expression

Example

SELECT CONVERT(Varchar(20),GETDATE(),20) AS [YYYY-MM-DD hh:mm:ss]   

Thank You

2 Comments

  1. BrianSwand

    You’ve among the best internet websites.

  2. Jameskar

    Love the site– very user pleasant and whole lots to see!

Leave a Reply

Prabhakaran Jayaraman