DROPs

Translation reference to convert SQL Server DROP FUNCTION and DROP PROCEDURE to Snowflake Scripting

Description

To drop a procedure or function in Snowflake SQL it is necessary to specify the parameters types in the drop statement, which is the main difference with SQL Server. In this translation, IF EXISTS clause is added by default to avoid runtime errors in Snowflake SQL.

Sample Source Patterns

The following examples details the drop routine statement for procedures and functions.

SQL Server

CREATE PROCEDURE SOMEPROCEDURE()
AS
BEGIN
    DROP FUNCTION SOMEFUNCTIONTODROP;
    DROP PROCEDURE IF EXISTS SOMEPROCEDURETODROP;
END;

Snowflake SQL

CREATE OR REPLACE PROCEDURE PUBLIC.SomeProcedure ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
  BEGIN
    DROP FUNCTION IF EXISTS SomeFunctionToDrop (FLOAT, STRING);
    DROP PROCEDURE IF EXISTS SomeProcedureToDrop ();
  END;
$$;

Known Issues

No issues were found.

No related EWIs

Last updated