Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_tst-customers_updateField]
- @itemID int,
- @field nvarchar(64),
- @value nvarchar(max),
- @username nvarchar(64)
- AS
- BEGIN
- -- обновление поля таблицы
- -- для приведения типов используйте try_cast(@value as int), Для даты try_convert(date, @value, 104)
- if(@field = 'name') begin
- update tst_customers set name = @value where id = @itemID
- end else if(@field = 'fio') begin
- update tst_customers set fio = @value where id = @itemID
- end else if(@field = 'vip') begin
- update tst_customers set vip = try_cast(@value as bit) where id = @itemID
- end else begin
- select 'Невалидный код свойства' Msg, 0 Result
- return
- end
- select '' Msg, 1 Result
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement