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)

Locate a column across databases

By Douglas Osborne,

This will search for a column across all databases.

You must specifiy the exact column spelling.

After that, you can get creative. If you have a number of databases, perhaps versioned by release, you can specifiy a @Branch suffix - so by passing in 0010 you would match

MyDatabase0010

MyBills0010

MyInvoice0010.

You can specify an exact databasse via @DB, and can specify if you want to see all matches, all tables, or all views.

Examples

EXECUTE dbo.LocateColumnDefinitions @Column = 'AccountID', @Branch = '0099'

EXECUTE dbo.LocateColumnDefinitions @Column = 'Address1', @DB = 'DATASERVICES'
EXECUTE dbo.LocateColumnDefinitions @Column = 'AccountID', @ViewTableAll = 'V'
EXECUTE dbo.LocateColumnDefinitions @Column = 'InsertDate',@ViewTableAll = 'V', @Branch = '0099

Total article views: 1175 | Views in the last 30 days: 3
 
Related Articles
FORUM

SSIS Branching

want ability to branch to one of two pathways defined by a variable

BLOG

Picking a Branch

Do you know that there are actually two branches of SQL Server 2008 code right now? Actually I would...

FORUM

execution plan

execution plan

FORUM

execution plan

execution plan

FORUM

Execute SSiS package

Execute

Tags
column    
database    
search    
utility    
 
Contribute

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
Editor, SQLServerCentral.com

Already a member? Jump in:

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