时间:2021-07-01 10:21:17 帮助过:4人阅读
--存储过程传入参数,默认值 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
SqlServer 创建服务器连接
标签:span pre style proc arch epo -- rom 创建