Greg Owen
Over 27 Years of Programming Experience
Programming Examples, Portfolio, and More
Home

SQL Server List Tables And Columns

The code below can be used to list tables and columns in a database provided your user account has permission to do so.


      –List Column Names

      SELECT COLUMN_NAME, TABLE_NAME
      FROM INFORMATION_SCHEMA.COLUMNS
      WHERE TABLE_CATALOG = 'YOUR_DB_NAME'

      –List Tables

      SELECT TABLE_NAME
      FROM INFORMATION_SCHEMA.TABLES
      WHERE TABLE_CATALOG = 'YOUR_DB_NAME'
      –List Views

      SELECT *
      FROM INFORMATION_SCHEMA.VIEWS
      WHERE TABLE_CATALOG = 'YOUR_DB_NAME'

      –List All Columns in All Views

      SELECT *
      FROM INFORMATION_SCHEMA.VIEW_COLUMN_USAGE
      WHERE TABLE_CATALOG = 'YOUR_DB_NAME'
      –List Stored Procedures

      SELECT *
      FROM sys.procedures

      –List a Stored Procedure Script

      EXEC sp_HelpText N'YourStoredProc'

    
#SQLServer
Some words from the sponsors...

Add a C# Dropdown to a Bootstrap Modal Dialog

This example combines C# and Bootstrap to create a bootstrap modal dialog containing an asp dropdown and an asp button to retrieve...

Continue Reading

Use C# to Populate Dropdown Lists With XML

The code below opens an xml file, reads the data from the xml file, dynamically adds a label for the dropdown list, and adds the dropdown list to the asp.net page...

Continue Reading

Add Style Properties to ASP.Net Controls to Improve Appearance

The default formatting for ASP.Net controls is very dated.  The default formatting is basically the same as the formatting in Visual Basic 1.0 ...

Continue Reading

Export To A Text File From A DataGridView Control

Add a button control to Form1.
Add a DataGridView Control to Form1....

Continue Reading