Select Column Information using SQL Server (geekzilla.co.uk)

submitted by fatdavehfatdaveh(1420) 5 years, 8 months ago

How to select information about columns in a table using SQL Server.

3 comments |category: |Views: 28

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by DamienGDamienG(1405) 5 years, 8 months ago 0

Selecting directly from the system tables is unsupported by Microsoft and is exactly why they created the sp_help stored procedure and it's associates.

[)amien

Reply

posted by DamienGDamienG(1405) 5 years, 8 months ago 0

Alternatively SQL 2005 adds metadata support for tables and columns using the syntax:

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'Products';

Where Products is the table you want.

[)amien

Reply

posted by fatdavehfatdaveh(1420) 5 years, 8 months ago 0

Damien: Wish I had seen INFORMATION_SCHEMA before.

When I get some time I will change the example accordingly

Good info, thanks

Reply

information Login or create an account to comment on this story