Script like below:
-- get table or view column
DECLARE @TableViewName NVARCHAR(128)
SET @TableViewName = N'testinvoice' -- table name
SELECT b.name AS ColumnName
,c.name AS DataType
,b.max_length AS Length
,b.precision as DataTypeprecision
,b.scale as DataTypescale
,c.Precision AS SystemMaxPrecision
,c.Scale AS SystemMaxScale
,d.value AS Description
FROM sys.all_objects a
INNER JOIN sys.all_columns b ON a.object_id = b.object_id
INNER JOIN sys.types c ON b.user_type_id = c.user_type_id
LEFT JOIN sys.extended_properties d ON a.object_id = d.major_id
AND b.column_id = d.minor_id
AND d.name = 'MS_Description'
WHERE a.Name = @TableViewName
AND a.type IN (
'U'
,'V'
)
Share on Twitter
Share on Facebook
Task Scheduler設定排程錯誤時發送Mail - Powershell
JOIN ON 常數的用途是什麼?跟放在WHERE一樣嗎?/ FULL JOIN要注意的事項- SQL Server
命令模式(Command Pattern),舉生活中的例子才好懂,懂吃一蘭拉麵就懂命令模式 - 設計模式
SEO(1) Github(2) Title Tag(2) ML(1) 李宏毅(1) SQL Server(18) Tempdb(1) SSMS(1) Windows(1) 自我成長(2) Excel(1) python Flask(1) python(5) Flask(2)
bart30508 (146)