hecrus

demo1 fastCreate

Oct 17th, 2020
593
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE PROCEDURE [dbo].[crud_tst-customers_fastCreate]
  2.     @filters CRUDFilterParameter READONLY,
  3.     @text nvarchar(256),
  4.     @username nvarchar(32)
  5. AS
  6. BEGIN
  7.     -- создание сущности в таблице по 1 полю @text
  8.  
  9.    
  10.     -- извлечение параметров из URL
  11.     --declare @filterItemID int
  12.     --select @filterItemID = try_cast(Value as int) from @filters where [Key] = 'itemID'
  13.    
  14.    
  15.     -- проверки
  16.     declare @id int
  17.     select @id = id from tst_customers where name = @text or fio = @text
  18.     if(@id>0) begin
  19.         select 'Такой заказчик уже существует!' Msg, 0 Result
  20.         return
  21.     end
  22.  
  23.  
  24.     -- добавление элемента в таблицу
  25.     insert into tst_customers(name, fio)
  26.     values(@text, @text )
  27.     select 'Заказчик создан' Msg, 1 Result
  28.  
  29. END
  30.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×