hecrus

Tree DeleteItem

Oct 24th, 2020
882
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE PROCEDURE [dbo].[tree_tst-catalog_deleteItem]
  2.     @id nvarchar(128)
  3.     @username nvarchar(32)
  4. AS
  5. BEGIN  
  6.     declare @count int
  7.     select @count = count(*) from tst_categories where parentID = @id
  8.    
  9.     if(isnull(@count,0)>0) begin
  10.     select 0 Result, 'Необходимо очистить подкатегории ('+cast(@count as nvarchar)+' шт.)' Msg
  11.     return
  12.     end
  13.    
  14.     delete from tst_categories where id = @id
  15.    
  16.     Select 1 Result, '' Msg
  17. END
  18.  
RAW Paste Data