create scalar function

Shambhu Rai 1,411 Reputation points

Hi Expert,

here is sql server scalar function how to convert in databricks function

CREATE function [dbo].[gettrans](@PickupCompany nvarchar(2),
@SupplyCountry int, @TxnSource nvarchar(10),       
@locId nvarchar(50), @ExternalSiteId nvarchar(50))      
  DECLARE @worldSiteid INT      
  SET @worldSiteid = 0      
If (@TxnSource = 'CDX')      
Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,424 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,666 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,068 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,118 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,326 Reputation points Microsoft Employee

    Hi Shambhu Rai,

    You are getting error as Cannot resolve function ufnGetGlobslSiteIdForTxns

    It seems you are calling python function ufnGetGlobslSiteIdForTxns before it got created. In Python language we need to create function first and then only we can make a call for it.

    Please check below video to understand more.

    Functions in Python

    Hope this helps. Please let me know if any further queries.

    Please consider hitting Accept Answer button. Accepted answers help community as well. Thank you.