CAST / CONVERT IN SQL SERVER 2005

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 )

CONVERT ( DATATYPE , Expression , Style )

-Pawan Kumar
Pawankkmr@hotmail.com

Advertisements