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 SOMEPROCEDURE ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
DROP FUNCTION IF EXISTS SOMEFUNCTIONTODROP ();
DROP PROCEDURE IF EXISTS SOMEPROCEDURETODROP ();
END;
$$;
Known Issues
No issues were found.
Related EWIs
SSC-EWI-0073: Pending Functional Equivalence Review.
Last updated