logo
Welcome Guest! To enable all features please Giriş or Kayıt.

Bildirim

Icon
Error

Ayarlar
Son mesaja git Go to first unread
mehmetzekikir  
#1 Gönderildi : 22 Kasım 2016 Salı 09:49:32(UTC)
mehmetzekikir

Sıralama: Administration

Gruplar: Administrators
Katılan: 6.05.2014(UTC)
Mesajlar: 670

19 Kere Teşekkür Etti.
152 Mesajına Toplam 253 Kere Teşekkür Edildi.
Merhabalar

Tablolaya ait kolonları görmek istiyorsanız aşağıdaki scripti kullanabilirsiniz,

Kod:

DECLARE @TableName sysname = NULL 
 
SELECT DB_NAME()        as [Database Name],  
        s.name            as [Schema Name], 
        t.name            as [Table Name], 
        c.name            as [Column Name], 
        ty.name            as [Column Data Type], 
        uty.name        as [Column System Type], 
        c.max_length    as [Column Maximum Length], 
        c.precision        as [Column Precision], 
        c.scale            as [Column Scale], 
        CASE c.is_nullable 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as [Column Is Nullable], 
        CASE c.is_identity 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as [Column Has Identity], 
        CASE c.is_computed 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as [Column Is Computed], 
        cc.definition    as [Computed Column Definition] 
FROM sys.tables as t 
INNER JOIN sys.schemas as s 
ON t.schema_id = s.schema_id 
INNER JOIN sys.columns as c 
ON t.object_id = c.object_id 
INNER JOIN sys.types as ty 
ON ty.user_type_id = c.user_type_id  
INNER JOIN sys.types as uty 
ON ty.system_type_id = uty.user_type_id 
LEFT JOIN sys.computed_columns as cc 
ON t.object_id = cc.object_id AND cc.column_id = c.column_id 
WHERE t.name = @TableName OR @TableName IS NULL 
UNION ALL 
SELECT DB_NAME()        as DatabaseName,  
        s.name            as SchemaName, 
        t.name            as TableName, 
        c.name            as ColumnName, 
        ty.name            as ColumnDataType, 
        ty.name            as ColumnSystemTypeName, 
        c.max_length    as ColumnMaximumLength, 
        c.precision        as ColumnPrecision, 
        c.scale            as ColumnScale, 
        CASE c.is_nullable 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as ColumnIsNullable, 
        CASE c.is_identity 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as ColumnHasIdentity, 
        CASE c.is_computed 
            WHEN 1 THEN 'Yes' 
            WHEN 0 THEN 'No' 
        END                as ColumnIsComputed, 
        cc.definition    as [Computed Column Definition] 
FROM sys.tables as t 
INNER JOIN sys.schemas as s 
ON t.schema_id = s.schema_id 
INNER JOIN sys.columns as c 
ON t.object_id = c.object_id 
INNER JOIN sys.types as ty 
ON ty.user_type_id = c.user_type_id AND ty.is_assembly_type = 1 
LEFT JOIN sys.computed_columns as cc 
ON t.object_id = cc.object_id AND cc.column_id = c.column_id 
WHERE t.name = @TableName OR @TableName IS NULL 



Sql Server 2016 Eğitimiz 19 Mayıs tarihinde başlayacaktır. 32 Saat Olup Ücret 1450 TL + KDV'dir. Kayıt ve ayrıntılar için tıklayınız

twitter.com/dbakademi
Dua ve teşekkür en büyük servetlere bedel...


Bu konudaki kullanıcılar
Guest (2)
Forumu Atla  
Bu foruma yeni konular postalayamazsınız.
Bu forumda ki konulara yeni posta gönderemezsiniz.
Bu forumdaki postalarınızı silemezsiniz.
Bu forumdaki postalarınızı düzenleyemezsiniz.
Bu forumda anketler yaratamazsınız.
Bu forumdaki anketlere oy veremezsiniz.