ColmunList.sql
1 |
Declare @TableName as nvarchar(50) |
---|---|
2 |
Set @TableName = 'AccessServerLog' |
3 |
|
4 |
/*
|
5 |
extendedproperty?ɗ\?ߒl?????Ă????ƊǗ??????₷??
|
6 |
MS_Description = ?J???????̐???
|
7 |
DataSours?@=?@?f?[?^?̎擾???̐???
|
8 |
Description?@=?@?J?????Ɋ֘A??????l?????Ă????i0:????/1:?L???Ȃǁj
|
9 |
|
10 |
*/
|
11 |
|
12 |
select
|
13 |
A.Name as TableName,
|
14 |
B.colid as ColmunID,
|
15 |
B.Name as ColmunName,
|
16 |
D.value as MS_Description,
|
17 |
D1.value as DataSours,
|
18 |
D2.value as Description,
|
19 |
C.Name as DataType,
|
20 |
B.length, |
21 |
B.xprec, |
22 |
B.xscale, |
23 |
A.crdate |
24 |
from sys.sysobjects A
|
25 |
inner join sys.syscolumns B on A.id = B.id |
26 |
left join sys.types C on B.xtype=C.system_type_id and B.xusertype=C.user_type_id |
27 |
left join (Select * From sys.extended_properties where Name='MS_Description') D on |
28 |
D.major_id = B.id AND D.minor_id = B.colid
|
29 |
left join (Select * From sys.extended_properties where Name='DataSours') D1 on |
30 |
D1.major_id = B.id AND D1.minor_id = B.colid
|
31 |
left join (Select * From sys.extended_properties where Name='Description') D2 on |
32 |
D2.major_id = B.id AND D2.minor_id = B.colid
|
33 |
where A.xtype='U' |
34 |
--and A.Name =@TableName
|
35 |
order by A.Name,B.colid |