存储过程传输范围

时间:2017-12-06 09:13:31

标签: sql sql-server-2012

我在存储过程中有一堆事务,这些事务不时失败,因为表不存在或列确实存在。

所以例如

If object_id ('test.dbo.test') is not null 
    drop table test

select *
into test   
from testdata

If object_id ('test.dbo.test2') is not null 
    drop table test2

select *
into test2
from testdata2

我正在考虑使用go来结束每个部分的批处理,但是这将从单词的第一个实例结束存储过程。

分号是否足够或者像开头和结尾那样用于此?

0 个答案:

没有答案
相关问题