Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Dynamic data dictionaries
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 09/12/2012 :  00:05:22  Show Profile  Reply with Quote

I am fairly new to SQL and am trying to create a stored procedure which dynamically generates a data dictionary for any database. Currently I have a stored procedure which given tablename and schema name as parameters generates the dictionary for that database. But I want to give the database name as parameter so that the dictionary is generated for any database. Is it even possible to do this? Please let me know.

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 09/12/2012 :  00:09:59  Show Profile  Reply with Quote
its possible. you just need to reference dbname in table name and use dynamic sql

ie as

EXEC('select * FROM ' + @dbname + '.INFORMATION_SCHEMA.TABLES')

SQL Server MVP

Go to Top of Page

Flowing Fount of Yak Knowledge

2886 Posts

Posted - 09/16/2012 :  00:00:01  Show Profile  Visit jezemine's Homepage  Reply with Quote
I wrote a shareware app that does this, see the link in my sig. works for many other DBMS besides MSSQL.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000