cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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
Databricks Employee
Databricks Employee

@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;

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now