<< Click to Display Table of Contents >> Navigation: Data Module > Import & export > Data mappings > SQL Basics > Functions > CAST and CONVERT |
Explicitly converts an expression of one data type to another. CAST and CONVERT provide similar functionality.
CAST ( expression AS data_type )
CONVERT ( data_type [ ( length ) ] , expression [, style])
data_type - Is the target system-supplied data type.
length - Is an optional parameter of nchar, nvarchar, char, varchar, binary, or varbinary data types.
style - Is an optional parameter that allows predefined or user-defined formatting of the data type. Style must be compatible with styles supported by the Visual Basic .NET Format function.
SELECT CAST(seller_rating as int) FROM [seller_info]
SELECT CONVERT(int, seller_rating) FROM [seller_info]