Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Dave http://pedotnet.blogspot.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Select DataBase Schema

// Select database schema.
//This could be used to recreate or test for existence of columns/tables
//or could also be used to create a database template system to enable the writing //of database schema into txt template file to be recreated again by reading the //txt file via an application
//
//You can also use SELECT * instead of defining each schema property (column)

   1  
   2  SELECT TABLE_CATALOG
   3  , TABLE_SCHEMA
   4  , TABLE_NAME
   5  , ORDINAL_POSITION
   6  , COLUMN_DEFAULT
   7  , IS_NULLABLE
   8  , DATA_TYPE
   9  , CHARACTER_MAXIMUM_LENGTH
  10  , COLLATION_NAME 
  11  FROM 
  12  INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = (N'Persons')
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS