CAST / CONVERT Difference IN SQL SERVER | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

CAST / CONVERT Difference IN SQL SERVER

23rd Mar 2017, 11:13 AM
Akwin Lopez
Akwin Lopez - avatar
1 Answer
0
Both cast and convert perform data type conversions for us. They both do the same thing with the exception that convert does some date formatting conversions that cast does not offer. CAST is ANSI complaint. CONVERT is not ANSI Complaint. Syntax: CAST ( Expression as DATATYPE ) CAST('2014-05-02' AS datetime); CONVERT ( DATATYPE , Expression , Style ) convert(varchar(16), dateTimeValue, 120)
23rd Mar 2017, 11:17 AM
Akwin Lopez
Akwin Lopez - avatar