Acquiring the data type in the user database tables and columns all the columns

Access to the database, all the user tables in each column name and data type.

 

SELECT OBJECT_NAME(c.OBJECT_ID) AS [Table_Name], c.[name] AS [Column_Name] ,t.[name] AS [Data_Type_Name]  
FROM sys.columns AS c  
LEFT JOIN SYSOBJECTS AS s ON (c.[object_id] = s.[id])  
LEFT JOIN sys.types AS t ON (c.[user_type_id]=t.[user_type_id])
WHERE s.xtype = 'U'
Source Code

 

Guess you like

Origin www.cnblogs.com/insus/p/12131525.html