SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

vineet99
Starting Member

1 Posts

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

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.

visakh16
Very Important crosS Applying yaK Herder

India
52249 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
http://visakhm.blogspot.com/

Go to Top of Page

jezemine
Flowing Fount of Yak Knowledge

USA
2884 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.


elsasoft.org
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.03 seconds. Powered By: Snitz Forums 2000