0

I can use code like this to extract the 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 am unable to determine the right kind of schema query to get the columns from my user-defined Table type. How is that done?

All ideas appreciated (Using .NET 4.5.1).

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Snowy
  • 5,942
  • 19
  • 65
  • 119

1 Answers1

1

Not sure if this is still a relevant question, but I just received an answer to something nearly identical. Check out the answer for this question:

Retrieve UDT table structure in VB.NET

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

declare @t MyUDTType; select * from @t;

Then returns the empty DataTable to the calling application.

Community
  • 1
  • 1