ADO.NET Get UDT columns from SQL Server 2012?

I can use code like this to extract columns from a SQL Server 2012 table:

    var sqlConnection = new SqlConnection(conns);
    var dt =  sqlConnection.GetSchema
(SqlClientMetaDataCollectionNames.Columns, new string[] { null , null ,  "mytable" , null });

      

However, I cannot figure out the correct kind of schema query to get the columns from my UDT table type. How it's done?

All ideas appreciated (using .NET 4.5.1).

0


source to share


1 answer


Not sure if this is still a valid question, but I just got an answer to something almost identical. Answer this question:

Get structure of UDT tables in VB.NET

The answer shows how to get the "sanitized" type name from sys.types, then it creates a simple sql query of the form:



declare @t MyUDTType; select * from @t;

Then it returns empty to the DataTable

calling application.

+1


source







All Articles