Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_tst-mysql_updateField]
- @itemID int,
- @field nvarchar(64),
- @value nvarchar(max),
- @username nvarchar(64)
- AS
- BEGIN
- declare @sql nvarchar(max) = ''
- if(@field = 'p1') begin
- set @sql = '
- update openquery(MYSQL1, ''select data1 from RemotelyCreatedTable where id = '+cast(@itemID as nvarchar)+''' )
- set data1='''+@value+'''
- where data1 <> '''+@value+'''
- '
- EXEC (@sql)
- end else if(@field = 'p2') begin
- set @sql = '
- update openquery(MYSQL1, ''select data2 from RemotelyCreatedTable where id = '+cast(@itemID as nvarchar)+''' )
- set data2='''+@value+'''
- where data2 <> '''+@value+'''
- '
- EXEC (@sql)
- end else begin
- select 'Невалидный код свойства' Msg, 0 Result
- return
- end
- select '' Msg, 1 Result
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement