﻿--Migration
DROP PROCEDURE IF EXISTS sp_Global_CreateSchema
DROP PROCEDURE IF EXISTS sp_Global_CreateSchemaAndOthers
DROP PROCEDURE IF EXISTS sp_Global_CreateSchemaAdvancedViews
DROP PROCEDURE IF EXISTS sp_Global_DeleteFunctions
DROP PROCEDURE IF EXISTS sp_Global_DeleteStoredProcedures
DROP PROCEDURE IF EXISTS sp_Global_DeleteViews
DROP PROCEDURE IF EXISTS dev.sp_Global_RemoveAdminUser
DROP PROCEDURE IF EXISTS dev.sp_Global_CreateAdminUser
DROP PROCEDURE IF EXISTS sp_Global_CreateSchemaViews
DROP PROCEDURE IF EXISTS dev.uspCloneIntezmenyList



DECLARE @sql nvarchar(MAX) = ''

SELECT @sql += 'DROP VIEW IF EXISTS [' + SCHEMA_NAME(v.schema_id) + '].[' + v.name + ']' + CHAR(13) + CHAR(10)
FROM sys.views v
WHERE v.name LIKE 'V[_]%'
  AND v.schema_id <> 1
  AND SCHEMA_NAME(v.schema_id) LIKE 'KR[_]%[_]Schema'

EXEC sys.sp_executesql @sql
GO  


