begin try
--执行的sql语句(这个sql语句是编译不报错的(没有能够检查出的语法错误,字段名、表名不存在不能够抛出异常))
end try
begin catch
--上面sql出错后的处理。
end catch
--例:
--select * into test01 from FactMZGHYYXX2020(执行两次插入创建语句后会报错)
begin try
select * into test01 from FactMZGHYYXX2020(执行两次插入创建语句)
end try
begin catch
--上面sql出错后的处理。
print '出错啦'
end catch