Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,442 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Expert,
how we can convert below code into databricks notebook
Convert(Decimal(9,2),Convert(varbinary(4),substring(ac.at_desc,9,4))*1/100.00) as 'test'
Thanks for posting your question in the Microsoft Q&A forum.
With Spark DataFrame API, you can do as following:
your_dataframe.withColumn(
'test',
(col('at_desc').substr(9, 4).cast('binary') * 1 / 100.00).cast('decimal(9,2)')
)
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **