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
Contributor

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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group