How to use Variables in Snowflake

preview_player
Показать описание

Learn how to work with variables in Snowflake.

Variables are a foundational component of any programming language, and SQL is no different. When it comes to Snowflake, the syntax at time can be slightly different when compared to other SQL versions, such as T-SQL.

In this video, we will review why you would want to use variables, how you can set/unset variables as well as how to see all existing variables in your session.

Timestamps:
00:00 - Intro
00:05 - Why Use Variables
01:02 - How to Set Variables
05::15 - How to Show Variables
07:34 - How to Unset Variables
08:30 - Closing

Title & Tags:
How to Use Variables in Snowflake | Snowflake SQL Variables | Set SQL Variables | Snowflake Tutorial
#kahandatasolutions #dataengineering #snowflake
Рекомендации по теме
Комментарии
Автор

Love the lofi? music in the background :)

Dabunni
Автор

Please make a video on Snowflake stored procedures please!

JimRohn-uc
Автор

Hi, this video is great, could you tell me how to set a variable from a select statement like in MS SQL like
declare @i int
select @i=max(id) from [dbo].[tbl]
select @i
Thanks

gordonash
Автор

Have you ever run into problems declaring variables. When I run a simple declare sSQL varchar(500) , I get syntax error at position..unexpected <EOF>. I am trying to dynamically create a sql statement but I run in to string size limitation when I use your described technique. All attempts to declare the variable and assign datatypes are failing.

hectors
Автор

Thank you for the video. I am trying to set column names as I use to in oracle, using variables, but I cannot get it to work. For example, SET NAME1 = IMPORTANT_NAME Select Some_Name as $NAME1 from table1. Snowflake does not like this or using identifier($NAME1) etc. Any thoughts on this. I have a ton of column names that change every month that I wanted to preset as variables so that I don't have to keep changing the code.

Thanks

robertb