Wednesday 15 May 2013

sql server - Retrieve schema of User Defined Table Type from C# -



sql server - Retrieve schema of User Defined Table Type from C# -

i wondering if there way in c# retrieve schema of user-defined table type sql database instance. see dbconnection class provides getschema() method getting table schema information, have not been able figure out way schema info user-defined table type. interested in retrieving name of type, , info columns info type, nullable, name, etc. have experience doing this? thanks!

note: question not asking how pass user-defined table type parameter stored procedure c#

use smo. i'm dba, powershell tool of choice, concepts should transferable:

import-module sqlps -disablenamechecking; $s = new-object microsoft.sqlserver.management.smo.server '.'; $db = $s.databases['mydatabase']; $db.userdefinedtabletypes | select schema, name;

once have userdefinedtabletype smo object, can utilize columns method on given type, homecoming collection of column objects. each of have relevant info columns (name, type, nullability, etc)

c# sql-server schema

No comments:

Post a Comment