cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

sql: how to convert datatype of column?

dan11
New Contributor II

Bricklayers,
I want to port this sql statement from sqlite to databricks:
select cast(myage as number) as my_integer_age from ages;
Does databricks allow me to do something like this?

1 REPLY 1

raela
New Contributor III
New Contributor III

@dan11

We don't support

number
in Spark SQL. Try using
int
,
double
,
float
, and your query should be fine. To run SQL in a notebook, just prepend any cell with %sql.

%sql
select cast(myage as double) as my_integer_age from ages;