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: 

What's the equivalent of "DECLARE..." in Databricks SQL ?

wyzer
Contributor II

Hello everyone,

I'm new in Databricks SQL, and I'm comming from SQL Server.

I would like to know what's the equivalent of :

DECLARE @P_Name varchar(50) = 'BackOffice'

It's for use it like this :

CREATE DATABASE @P_Name

Thanks.

15 REPLIES 15

Amit_352107
New Contributor III

Hi @Salah K.​ 

you can go through this code block

%python

P_Name = 'BackOffice'

spark.sql(f""" create database {P_name} """)

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