I need to get all information for user defined table type columns (name ,type , null or not ) so I can generate a backup scrip for all table types I got .
I have just written and tested this on SQL Server 2014, hopefully should work with all versions.
Select t.name [TableTypeName]
,SCHEMA_NAME(t.schema_id) [SchemaName]
,c.name [Column Name]
,y.name [Data Type]
,c.max_length
,c.precision
,c.is_identity
,c.is_nullable
From sys.table_types t
Inner join sys.columns c on c.object_id = t.type_table_object_id
Inner join sys.types y ON y.system_type_id = c.system_type_id
WHERE t.is_user_defined = 1
AND t.is_table_type = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With