Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

get rich schema details of all or some tables

By bob chatsrinopkun,

to get information about tables+columns+primarykeys+foreignkeys+identity, i firstly used SQL server built-in INFORMATION_SCHEMA.xxx. however, my company have various DBAs and each of them owns objects. when using INFORMATION_SCHEMA.xxx, it retrieves data based on current login (version 2005 resolves this schema v.s. object owner problem already... yeah) , which bring me a great trouble. if you want to see problems, try to use INFORMATION_SCHEMA.xxx to get primary key details of objects not own by current login. so i develop my own version, which is not related to login. try for yourself. btw... support version 7/2000/2005


the process uses two functions together
1) infFKfrom to get foreign keys
2) infTB to compose fk-data with others

you can use the function these ways...
select * from infTB('%') --> to get all info of user tables
select * from infTB('%some%table%') --> to get some

good luck

Total article views: 531 | Views in the last 30 days: 2
 
Related Articles
FORUM

Objects Accessible by a Login / User

Objects Accessible by a Login / User

FORUM

How to Find Object Versions

How to Find Object Versions ,(Procedure ,views,Fucntions..)

SCRIPT

Find all objects in Server Owned by a Login

Find every object in every database owned by a particular Login.

FORUM

How do I version control SQL Server objects?

Version control SQL Server 2008 objects

FORUM

Add SQL Objects to TFS/ Version Control

Trying to add SQL Objects to Source Control and versioning

 
Contribute