2013-04-26 8 views
10

the sysobjects documentation göre, bu nesne türlerinden biri olabilir:sysobjects.xtype açıklamalarının listesini tutan bir tablo var mı?

| xtype |    Description    | 
|-------|---------------------------------------| 
| AF | Aggregate function (CLR)    | 
| C  | CHECK constraint      | 
| D  | Default or DEFAULT constraint  | 
| F  | FOREIGN KEY constraint    | 
| L  | Log         | 
| FN | Scalar function      | 
| FS | Assembly (CLR) scalar-function  | 
| FT | Assembly (CLR) table-valued function | 
| IF | In-lined table-function    | 
| IT | Internal table      | 
| P  | Stored procedure      | 
| PC | Assembly (CLR) stored-procedure  | 
| PK | PRIMARY KEY constraint (type is K) | 
| RF | Replication filter stored procedure | 
| S  | System table       | 
| SN | Synonym        | 
| SQ | Service queue      | 
| TA | Assembly (CLR) DML trigger   | 
| TF | Table function      | 
| TR | SQL DML Trigger      | 
| TT | Table type       | 
| U  | User table       | 
| UQ | UNIQUE constraint (type is K)  | 
| V  | View         | 
| X  | Extended stored procedure   | 

ve ben bir CASE deyimi içine bu verdiler, ama sadece o xtype açıklamasına bakmayı üzerinde katılabilir bir tablo var mı? Biliyorum, systypes bu masa değil. Demek istediğim, bir sürü şeyi ezberledim, ama bir veri tabanı üzerinde biraz araştırma yapıyorum ve bana yabancı geliyor (yani bu konuda bir ton bile bilmiyorum) ve bu yüzden inşa etmek istiyorum bir CASE açıklamada olmadan bu sorgu içine açıklaması:

select object_name(c.id), c.name, [length], o.xtype from syscolumns c 
    join sysobjects o on o.id = c.id 
where c.name like '%job%code%' 
Güncelleme Aşağıda

SQLMenace tarafından cevap sonrasında nihai sonucudur. Buraya yerleştirilmem gerektiğini hissettim çünkü sadece join numaralı telefondan değil.

select object_name(c.id), c.name, t.name, c.[length], o.xtype, x.name from syscolumns c 
    join sysobjects o on o.id = c.id 
    join systypes t on t.xtype = c.xtype 
    join master..spt_values x on x.name like '%' + o.xtype + '%' and x.type = 'O9T' 
where c.name like '%job%code%' 
order by c.xtype 

cevap

11

bu

SELECT name 
FROM master..spt_values 
WHERE type = 'O9T' 

Çıktı

AF: aggregate function 
AP: application 
C : check cns 
D : default (maybe cns) 
EN: event notification 
F : foreign key cns 
FN: scalar function 
FS: assembly scalar function 
FT: assembly table function 
IF: inline function 
IS: inline scalar function 
IT: internal table 
L : log 
P : stored procedure 
PC : assembly stored procedure 
PK: primary key cns 
R : rule 
RF: replication filter proc 
S : system table 
SN: synonym 
SQ: queue 
TA: assembly trigger 
TF: table function 
TR: trigger 
U : user table 
UQ: unique key cns 
V : view 
X : extended stored proc 
sysobjects.type, reports 
+0

Fantastik yanıt yoktur !! Sorumu son sonuçtan dolayı düzenledim çünkü 'katıl' normdan biraz farklı, bu yüzden herkes ona nasıl katılacağımı açık bir şekilde görebiliyordu. –