Advertisement
hecrus

MySQL FastCreate

Oct 18th, 2020
2,282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.55 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-mysql_fastCreate]
  2.     @filters CRUDFilterParameter READONLY,
  3.     @text nvarchar(256),
  4.     @username nvarchar(32)
  5. AS
  6. BEGIN
  7.     -- создание сущности в таблице по 1 полю @text
  8.     declare @id int
  9.     select @id = id from openquery(MYSQL1, 'select  id from RemotelyCreatedTable order by id desc limit 1')
  10.     set @id = isnull(@id, 0) + 1
  11.  
  12.     insert into openquery(MYSQL1, 'select * from RemotelyCreatedTable')
  13.     values (@id, @text, @text)
  14.  
  15.     select 'Элемент создан' Msg, 1 Result
  16.  
  17. END
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement