Advertisement
Ruslan_Rayanov

Map UpdateField

Oct 18th, 2020
300
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_testMap_updateField]
  2.     @itemID int,
  3.     @field nvarchar(64),
  4.     @value nvarchar(max),
  5.     @username nvarchar(64)
  6. AS
  7. BEGIN
  8.  
  9. if(@field = 'marker') begin
  10.     declare @lat nvarchar(32), @lng nvarchar(32)
  11.     set @lat = [dbo].[str_splitPart](@value,  '||', 1   )
  12.     set @lng = [dbo].[str_splitPart](@value,  '||', 2   )
  13.  
  14.     update tst_addresses
  15.     set lat = @lat, lng = @lng
  16.     where id = @itemID    
  17. end else begin
  18.     select 'Невалидный код свойства' Msg, 0 Result
  19.     return
  20. end  
  21. select '' Msg, 1 Result
  22.  
  23. END
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement