Store Procedure to Rename certain objects in SQL Server
The SP_RENAME system store procedure can be emulated in Snowflake in certain scenarios. In general, the equivalent is the EXECUTE IMMEDIATE using a dynamic statement with the ALTER TABLE and the original parameters.
Translation Examples for Tables
Source
IN -> SqlServer_1.sql
EXEC sp_rename 'TABLE1', 'TABLENEW1'
Output
OUT -> SqlServer_1.sql
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0075 - TRANSLATION FOR BUILT-IN PROCEDURE 'sp_rename' IS NOT CURRENTLY SUPPORTED. ***/!!!
EXEC sp_rename 'TABLE1', 'TABLENEW1';
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0075 - TRANSLATION FOR BUILT-IN PROCEDURE 'sp_rename' IS NOT CURRENTLY SUPPORTED. ***/!!!
EXEC sp_rename 'sample_BACKUP_2.column_old', 'column_new', 'COLUMN';!!!RESOLVE EWI!!! /*** SSC-EWI-TS0075 - TRANSLATION FOR BUILT-IN PROCEDURE 'sp_rename' IS NOT CURRENTLY SUPPORTED. ***/!!!
EXEC sp_rename 'database1.sample_BACKUP_3.column_old', 'column_new', 'COLUMN';