找回密码
 立即注册

QQ登录

只需一步,快速开始

平底锅

高级会员

17

主题

21

帖子

1327

积分

高级会员

积分
1327

活字格认证

平底锅
高级会员   /  发表于:2010-10-10 12:57  /   查看:5191  /  回复:0
在使用Object_ID函数时,有一个可选项的object_type,在使用时经常搞错,现从SQL Online help上把Type类型
摘抄下来,同时,把最常用的Type用红色标记。

摘抄源URL: ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/f8d6163a-2474-410c-a794-997639f31b3b.htm

OBJECT_ID ( '[ database_name . [ schema_name ] . | schema_name . ] object_name' [ ,'object_type' ] )

Object type:
AF = Aggregate function (CLR)
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
FN = SQL scalar function
FS = Assembly (CLR) scalar-function
FT = Assembly (CLR) table-valued function
IF = SQL inline table-valued function
IT = Internal table
P = SQL Stored Procedure
PC = Assembly (CLR) stored-procedure
PG = Plan guide
PK = PRIMARY KEY constraint
R = Rule (old-style, stand-alone)
RF = Replication-filter-procedure
S = System base table
SN = Synonym
SQ = Service queue
TA = Assembly (CLR) DML trigger
TF = SQL table-valued-function
TR = SQL DML trigger
U = Table (user-defined)
UQ = UNIQUE constraint
V = View
X = Extended stored procedure


---------------------------------
例如:下边检查AWBuildVersion表是否存在时,Object_Type用了"U"
USE AdventureWorks;
GO
IF OBJECT_ID (N'dbo.AWBuildVersion', N'U') IS NOT NULL
                DROP TABLE dbo.AWBuildVersion;
GO

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部