我有像這樣一個存儲過程,它基本上附加一個前綴字段,如果它不存在:存儲過程不更新領域
ALTER PROCEDURE [dbo].[AgSp_UpdateAgTbl_Licensing ](@newPrefix nvarchar, @systemName nvarchar)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
update AgTbl_Licensing
set UrlPrefixes =
case
when UrlPrefixes is null or UrlPrefixes = ''
then @newPrefix
else convert (nvarchar(max), UrlPrefixes) + ', '[email protected]
end
where SystemName = @systemName and (UrlPrefixes not like ('%'[email protected]+'%') or UrlPrefixes is null)
END
我嘗試把這個像這樣:
Execute AgSp_UpdateAgTbl_Licensing 'eb_', 'EB1';
但更新沒有對數據庫進行 - 怎麼回事?我不能調試,因爲我沒有系統管理員
如果您在代碼片外執行它,代碼是否會操作? –
是的,如果我把價值,而不是使用參數的更新 – raklos
我昨天以不同的格式回答了這個問題:) http://stackoverflow.com/questions/14610368/update-and-append-unless-empty/14610946# 14610946 – Kaf