标签:span pre style proc arch epo -- rom 创建
--创建链接服务器 exec sp_addlinkedserver ‘ITSV‘ , ‘‘ , ‘SQLOLEDB‘ , ‘192.168.1.232‘ exec sp_addlinkedsrvlogin ‘ITSV‘ , ‘false‘ , null , ‘sa‘ , ‘********‘ --以后不再使用时删除链接服务器 exec sp_dropserver ‘ITSV‘, ‘droplogins‘ --执行存储过程 --exec batch_import ‘err‘ --测试报错
--存储过程传入参数,默认值 ALTER PROCEDURE [dbo].[batch_import] @ear_id varchar(20), @del_flag varchar(20) = null
--存储过程开事务
BEGIN TRY
SET XACT_ABORT ON;
BEGIN TRAN
if(@ear_id=‘err‘)
begin
insert into os_report select TOP(1) * from os_report
end
COMMIT TRAN
select ‘执行完成‘, @ear_id as ear_id
END TRY
BEGIN CATCH
ROLLBACK TRAN
select error_number() as error_number,error_message() as error_message,error_state() as error_state,error_severity() as error_severity, @ear_id as ear_id
END CATCH
标签:span pre style proc arch epo -- rom 创建
原文地址:https://www.cnblogs.com/mapstar/p/13187022.html