获取SqlServer 2005中字段的备注信息--downmoon
2007-09-28 17:27
344 查看
在上篇文章
中,介绍了如何获取SqlServer 2000中字段的备注信息
本文将介绍如何获取SqlServer 2005中字段的备注信息(downmoon)
Declare
@tblName
nvarchar
(
1000
)
set
@tblName
=
'
表名
'
declare
@TblID
int
set
@TblID
=
(
select
[
object_id
]
as
tblID
from
sys.all_objects
where
[
type
]
=
'
U
'
and
[
name
]
<>
'
dtproperties
'
and
[
name
]
=
@tblName
)
select
syscolumns.name
as
ColumnName,
systypes.name
as
ColumnType,
syscolumns.length
as
ColumnLength,
(
SELECT
[
value
]
FROM
::fn_listextendedproperty(
NULL
,
'
user
'
,
'
dbo
'
,
'
table
'
,
object_name
(
@TblID
),
'
column
'
, syscolumns.name)
as
e
where
e.name
=
'
MS_Description
'
)
as
ColumnDescription
from
sysColumns
left
join
sysTypes
on
sysTypes.xtype
=
sysColumns.xtype
and
sysTypes.xusertype
=
sysColumns.xusertype
left
join
sysobjects
on
sysobjects.id
=
syscolumns.cdefault
and
sysobjects.type
=
'
D
'
left
join
syscomments
on
syscomments.id
=
sysobjects.id
where
syscolumns.id
=
@TblID
中,介绍了如何获取SqlServer 2000中字段的备注信息
本文将介绍如何获取SqlServer 2005中字段的备注信息(downmoon)
Declare
@tblName
nvarchar
(
1000
)
set
@tblName
=
'
表名
'
declare
@TblID
int
set
@TblID
=
(
select
[
object_id
]
as
tblID
from
sys.all_objects
where
[
type
]
=
'
U
'
and
[
name
]
<>
'
dtproperties
'
and
[
name
]
=
@tblName
)
select
syscolumns.name
as
ColumnName,
systypes.name
as
ColumnType,
syscolumns.length
as
ColumnLength,
(
SELECT
[
value
]
FROM
::fn_listextendedproperty(
NULL
,
'
user
'
,
'
dbo
'
,
'
table
'
,
object_name
(
@TblID
),
'
column
'
, syscolumns.name)
as
e
where
e.name
=
'
MS_Description
'
)
as
ColumnDescription
from
sysColumns
left
join
sysTypes
on
sysTypes.xtype
=
sysColumns.xtype
and
sysTypes.xusertype
=
sysColumns.xusertype
left
join
sysobjects
on
sysobjects.id
=
syscolumns.cdefault
and
sysobjects.type
=
'
D
'
left
join
syscomments
on
syscomments.id
=
sysobjects.id
where
syscolumns.id
=
@TblID
相关文章推荐
- 获取SqlServer 2005中字段的备注信息
- 获取SqlServer 2005中字段的备注信息
- 获取SqlServer 2000中字段的备注信息--downmoon
- 获取SqlServer 2000中字段的备注信息
- 获取MS SqlServer 2000中字段的备注信息
- 教你如何在 sql server 2005 使用 sql 语句获取字段的说明信息
- 获取mysql表中字段备注信息以及选中数据库中表的备注信息
- Sqlserver获取所有数据库名,表信息,字段信息,主键信息,以及表结构等。
- sqlserver 2005 开发斑安装,出现 "SQL Server 安装程序无法获取 ASPNET 帐户的系统帐户信息"的解决方法
- 获取SQLSERVER所有库 所有表 所有列 所有字段信息
- Sqlserver获取所有数据库名,表信息,字段信息,主键信息,以及表结构等。
- sql2005 获取表字段信息和视图字段信息
- SQL 2005中取出字段的备注信息
- SQL 2005 字段备注获取
- 获取SQLSERVER一张表里面的常用字段信息
- 获取SqlServer数据表所有字段的信息
- 获取MSSQL 表结构中字段的备注、主键等信息
- 获取MSSQL 表结构中字段的备注、主键等信息的sql
- sqlserver 2008获取列备注信息