CAST (expression)

Converts expression from its original format into the chosen format.

Syntax:

CAST( expression as DataType )

Data Types:

  • BIT
  • CHAR
  • VARCHAR
  • NVARCHAR
  • NCHAR
  • TEXT
  • NTEXT
  • DATE
  • DATETIME
  • DECIMAL
  • DOUBLE
  • FLOAT
  • INTEGER
  • VARCHAR
  • REAL
  • SMALLINT
  • TINYINT

See also: SAFECAST.

Example:

CAST(Expression AS TEXT) 
CAST(Expression AS DATETIME)
CAST(Expression AS BIT)
CAST(Expression AS TINYINT)
CAST(Expression AS SMALLINT)
CAST(Expression AS INTEGER)
CAST(Expression AS BIGINT)
CAST(Expression AS REAL)
CAST(Expression AS DOUBLE)
CAST(Expression AS DECIMAL)
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.