woensdag 30 augustus 2023

Difference between SQL Server and Snowflake

 A small blogpost about a nice feature of Snowflake. I stumbled upon an interesting difference between SQL Server and Snowflake.  It is about using an alias in the same query. I've never seen this before, but i'm biased to Microsoft of course. 


So here is the thing. Suppose you have the following query :


SELECT 1 AS TEST,
    TEST + 1 AS TEST2


In SQL Server it will generate an error



But in Snowflake it will run!



Now why could this be important? Well, when I write queries in SQL, I  sometimes have to reuse functionality multiple times in the same query. Here it can help to reuse coding and adjust the code at one place instead of multiple places in the same query.


Hennie

Geen opmerkingen:

Een reactie posten