Sybase 判断对象是否存在于数据库中的两种方式
一 使用OBJECT_ID方式
IF OBJECT_ID('dbo.TableName') IS NOT NULL
BEGIN
DROP TABLE dbo.TableName
PRINT '<<< DROPPED TABLE dbo.TableName>>>'
END
二 查询sysobjects表
IF EXISTS (SELECT * FROM sysobjects WHERE name = "TableName" AND type = "U")
BEGIN
DROP table TableName
PRINT "TABLE %1! DROPPED", TableName
END