O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting Data Types with CAST()

In many situations, your DBMS will convert, or cast, data types automatically. It may allow you to use numbers and dates in character expressions such as concatenation, for example, or it will promote numbers automatically in mixed arithmetic expressions (see the DBMS Tip in “Performing Arithmetic Operations” earlier in this chapter). Use the CAST() function to convert an expression of one data type to another data type when your DBMS doesn’t perform the conversion automatically. For information about data types, see “Data Types” in Chapter 3.

The CAST() function’s important characteristics are:

  • Implicit conversions are those conversions that occur without specifying CAST(). Explicit conversions are those conversions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required