Mega Code Archive

 
Categories / MSSQL Tutorial / Data Types
 

Identifying Columns and Parameters that Use User-Defined Types

4> 5> CREATE TYPE dbo.AccountNBR FROM char(14) NOT NULL 6> GO 1> 2> CREATE TABLE dbo.MyCount 3> (ID int NOT NULL, 4>  AccountNBR AccountNBR) 5> GO 1> 2> SELECT OBJECT_NAME(c.object_id) Table_Name, c.name Column_Name 3> FROM sys.columns c 4> INNER JOIN sys.types t ON 5> c.user_type_id = t.user_type_id 6> WHERE t.name = 'AccountNBR' 7> GO Table_Name          Column_Name ------------------------------------------------------------------------------------------------------------------------ -------- --------------------------------------------------------------------------------------------------------------- ----------------- MyCount          AccountNBR 1> 2> 3> drop table dbo.MyCount 4> GO 1> 2> drop type dbo.AccountNBR 3> GO