1、判断“表”是否存在:
if exists (select * from sysobjects where id = object_id(N'[dbo].[表名]'and OBJECTPROPERTY(id, N'IsUserTable'= 1
  
print '存在'
else
  
print '不存在'

2、判断“存储过程”是否存在:
if exists(select   1   from   sysobjects   where   id=object_id('所有者.存储过程名')   and   xtype='P')   
  print   
'存在'   
else   
  print   
'不存在' 
posted on 2009-10-29 22:27  钱途无梁  阅读(398)  评论(0编辑  收藏  举报