SQL Reference
Scalar Data Conversion Functions
these functions convert one data type to another scalar data conversion functions 119,213,331 true falseleft unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type implicit conversions in certain situations, {{ocient}} sql can automatically convert expressions to a specific data type without an explicit sql statement cast from strings you can cast string literals to any other data type by placing the name of the data type before the string literal examples cast a double cast the value 1 5 from a string to a floating point value select double '1 5'; output 1 5 cast an array cast the array int\[0,1,2,3] from a string to an array of integers select int\[] 'int\[0,1,2,3]'; output \['0','1','2','3'] cast a point value cast the point value point(0 0) to the geospatial data type point in this case, the cast keyword is st point , and the data type is point select st point 'point(0 0)'; output point(0 0 0 0) cast from date and time strings you can cast d ate and time values to their interval value with the interval keyword retrieve interval values from various date and time strings retrieve the interval value 5 from the '5 days' string select interval '5 days'; output 5 retrieve the interval value 2 from the '2 weeks' string select interval '2 weeks'; output 2 retrieve the interval value 10 from the '10 seconds' string select interval '10 seconds'; output 10 cast functions these sql statements allow casting an expression to any other data type cast transforms an expression to any other data type this function operates similarly to the scalar data conversion functions /# operator syntax cast\[!] expr \[as] data type 118,191,371 true falseleft unhandled content type left unhandled content type left unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type as shown in the syntax examples, cast can support the optional ! operator the ! operator returns a null value if the operation cannot cast to the specified data type this behavior prevents situations where the system would normally raise an error examples cast an integer to varchar transform the value 2 as a varchar string select cast(2 as varchar); output '2' cast a varchar to date transform the '2020 02 02' string to the date data type select cast('2020 02 02' as date); output '2020 02 02' cast an incompatible type with the ! operator transform the 'a' string to an integer, or int data type, using the ! operator select cast!('a' as int); output null this operation generates null because the database cannot transform this value to an integer without adding this operator, the statement raises an error because the database cannot transform the input expression to a numeric type \ operator transforms an expression to any other data type this function operates similarly to the scalar data conversion functions /#cast function \ syntax expr \[!] data type 118,191,371 true falseleft unhandled content type left unhandled content type left unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type left false unhandled content type as shown in the syntax examples, can support the optional ! operator the ! operator returns a null value if the operation cannot cast to the specified data type this behavior prevents situations where the system would normally raise an error examples cast an integer to float transform the '2' string to a floating point number select '2' float; output 2 0 cast to an incompatible type with the ! operator transform the 'a' string to an integer, or int data type, using the ! operator select 'a' ! int; output null this operation generates null because the database cannot transform this value to an integer without adding this operator, the statement raises an error because the database cannot transform the input expression to a numeric type related links date and time functions docid\ zcon ufstf4uhc5airgpg character and binary functions docid\ kolkdboplprrwxs3g6gsh math functions and operators docid\ e2c2vckzh8dfsbp1wngpr formatting functions docid\ u47hjysi1oojk6eg2kjut