A list of one owl's 5 favourite system stored procedures in SQL!
Part five of a six-part series of blogs

Everyone has a favourite system stored procedure (you do, don't you?). But five? That's the subject of this blog, anyway.

  1. My 5 favourite SQL system stored procedures!
  2. Listing the contents of a procedure or function (sp_helptext)
  3. Using sp_datatype_info to get the data type of a variable
  4. Which tables/procedures depend on which? (sp_depends)
  5. Listing the columns in a table (sp_columns) (this blog)
  6. Using sp_help to get help on a table, procedure, column, etc

Posted by Andy Brown on 03 February 2017

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Listing the columns in a table (sp_columns)

Want to know what's in a table without having to click on it?  Here's an example, listing the columns in a table called Director:

-- list out the columns used by this table

sp_columns 'Director'

Here are the first few columns this returns:

Columns in table

The first few columns of information returned.

You can also use sp_tables on its own to list out all of the tables in your database.

This blog has 0 threads Add post