Skip to content Skip to sidebar Skip to footer

Is There A C# Api For Sys.tables And Sys.procedures?

Before I run off and write my own version from scratch, is there an API that exposes the system views in SQL Server (e.g. sys.tables and sys.procedures) to C#?

Solution 1:

As you suggest, you can use ADO.NET to query the system catalogs.

You could also use LINQ to SQL:

  • Open Server Explorer in Visual Studio. Open a connection to the server.

  • Right-click the server and choose Change View > Object Type.

  • Under System Tables and User Tables, you can drag a system object onto a .dbml surface.


For database specific objects use SMO (SQL Server Management Objects)

In C# add Microsoft.SqlServer.Management.Smo

SQL Server Management Objects (SMO) Programming Guide

This might be of use: Reference Microsoft.SqlServer.Smo.dll

Post a Comment for "Is There A C# Api For Sys.tables And Sys.procedures?"