IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_update_product_text]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_update_product_text]
GO
CREATE proc [dbo].[mps_update_product_text]
@prd_id bigint,
@prd_text text
as
begin
set nocount on;
begin try
declare @count int
--先直接更新
update mps_prd_text set pt_prdtext= @prd_text  where pt_prdid=@prd_id
--如果没有找到对应的就创建一条记录
if(@@rowcount=0)
begin
insert into mps_prd_text(pt_prdid,pt_prdtext) values(@prd_id, @prd_text );
end
end try
begin catch
select ERROR_MESSAGE() as 'error';
end catch
end