Freshers Aptitude technical questions
Freshers Job Alert
Bookmark and Share

  CAST, CONVERT, CASE

Cast & 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 ] )

Implicit conversions are those conversions that occur without specifying either the CAST or CONVERT function. Explicit conversions are those conversions that require the CAST (CONVERT) function to be specified. This chart shows all explicit and implicit data type conversions allowed for SQL Server system-supplied data types, including bigint and sql_variant .

The CASE function is a special Transact-SQL expression that allows an alternative value to be displayed depending on the value of a column. This change in data is temporary; therefore, there are no permanent changes to the data. For example, the CASE function can display California in a query result set for rows that have the value CA in the state column.