MSCEWI4025

ERROR_SEVERITY function transformed

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Low

Description

This EWI is added when ERROR_SEVERITY built-in function is translated. By default, the function will return 16 as it is the most common severity in SQL Server. The generated UDF should retrie

Code Example

Input Code:

CREATE procedure proc1()
as
BEGIN TRY  
    -- Generate a divide-by-zero error.  
    SELECT 1/0 from table1;  
END TRY  
BEGIN CATCH  
    return ERROR_SEVERITY();  
END CATCH;  
GO  

Output Code:

CREATE OR REPLACE PROCEDURE proc1 ()
RETURNS STRING
LANGUAGE JAVASCRIPT
EXECUTE AS CALLER
AS
$$
   // REGION SnowConvert Helpers Code
   // END REGION

   try {
      EXEC(`    -- Generate a divide-by-zero error.  
    SELECT 1/0 from PUBLIC.table1`);
   } catch(error) {
      return SELECT(`/*** MSC-WARNING - MSCEWI4025 - CUSTOM UDF 'ERROR_SEVERITY_UDF' INSERTED FOR ERROR_SEVERITY FUNCTION. ***/
ERROR_SEVERITY_UDF()`);
   }
$$;
-- ** MSC-WARNING - MSCEWI1040 - THE STATEMENT IS NOT SUPPORTED IN SNOWFLAKE **
--GO

Recommendations

Last updated