Code Snippets

  

mySQL Source Code


Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,776 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,274 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!




MSSQL equivalent to describe

Since MSSQL does not offer the describe command, it can be frustrating digging through the columns. Maybe this can help! Found at http://www.crydust.be/blog/2006/12/26/mssql-lacks-describe-statement : and added constraint_type

Submitted By: no2pencil
Actions:
Rating:
Views: 184

Language: mySQL

Last Modified: July 2, 2008
Instructions: change tablename to the appropriate name of the table you are getting details on.

Snippet


  1. SELECT
  2.     column_name
  3. ,   data_type +
  4.     COALESCE(
  5.        '(' + CAST(character_maximum_length AS VARCHAR) + ')'
  6.     ,  '(' + CAST(numeric_precision AS VARCHAR) + ')'
  7.     ,  ''
  8.     )
  9. ,   column_default
  10. ,   constraint_type
  11. ,   is_nullable
  12. FROM
  13.     information_schema.columns
  14. WHERE
  15.     table_name = 'tablename';

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month