//获取指定表信息
select * from sys.all_objects where type='u' and name='table_name'
//获取一个表中的所有字段信息
select * from sys.syscolumns where id=(select object_id from sys.all_objects where type='u' and name='table_name')
//获取当前帐户自己创建的表信息
--判断用户表是否存在
if objectproperty(object_id( '要判断的表名 '), 'IsUserTable ')=1
print '存在 '
--判断指定的存储过程是否存在
if objectproperty(object_id( '要判断的表名 '), 'IsProcedure ')=1
print '存在 '
select * from sys.all_objects where type='u' and name='table_name'
//获取一个表中的所有字段信息
select * from sys.syscolumns where id=(select object_id from sys.all_objects where type='u' and name='table_name')
//获取当前帐户自己创建的表信息
select * from sys.objects where type_desc='user_table'
注释:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--判断用户表是否存在
if
--判断指定的存储过程是否存在
if