﻿DROP PROCEDURE IF EXISTS sp_ElozoTanevesViewokTorlese
GO

CREATE PROCEDURE sp_ElozoTanevesViewokTorlese
   @pintezmenyId INT
  ,@pintezmenyAzonosito NVARCHAR(MAX)
  ,@pkovTanevId INT
WITH EXECUTE AS 'kreta_tech_user'
AS
BEGIN
  SET NOCOUNT ON

  DECLARE @schemaName nvarchar(max) = CONCAT(N'KR_', @pintezmenyAzonosito, N'_Schema')

  EXEC dev.uspDeleteViewsAll @schemaName
  EXEC sp_Global_CreateSchemaViews @pintezmenyId, @pintezmenyAzonosito, @pkovTanevId
END
GO
