Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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 however, my company have various DBAs and each of them owns objects. when using, 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 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

Objects Accessible by a Login / User

Objects Accessible by a Login / User


How to Find Object Versions

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


Find all objects in Server Owned by a Login

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


How do I version control SQL Server objects?

Version control SQL Server 2008 objects


Add SQL Objects to TFS/ Version Control

Trying to add SQL Objects to Source Control and versioning


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones