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: 

Help Refactor T-SQL Code to Databricks SQL

Carlton
New Contributor III

Hello Community

Can someone help refactor the following T-SQL Code to Databricks SQL

CONVERT(DECIMAL(26, 8), ISNULL(xxx.xxxxxxx * ISNULL(RH.xxxxx, 1 / NULLIF(ST.xxxxxx, 0)), ST.xxxxx)) AS Amount

When I attempt to execute the above code I get the following error:

Error in SQL statement: AnalysisException: Undefined function: 'CONVERT'.

 

 

 

1 REPLY 1

AmanSehgal
Honored Contributor III

You can use CAST instead.

Eg:

SELECT cast('2024' as int);
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!