Here's a quick and dirty routine I use all the time. This simple procedure will list all tables in your database where a particular field is found. Not earth shattering by any means, but useful and since I find I use it all the time, I thought someone else might find it userful and same them the brief effort to write their own!
IF EXISTS(SELECT name FROM sysobjects WHERE name = 'sp_findField' AND type='P')BEGIN DROP PROCEDURE sp_findFieldENDGO
CREATE PROCEDURE dbo.sp_findField (@fieldName varchar(100))ASBEGIN SET NOCOUNT ON
SELECT so.name FROM sysobjects so, syscolumns sc WHERE so.id = sc.id AND sc.name = @fieldName ORDER BY so.name
ENDGO
GRANT EXECUTE ON sp_findField TO publicGO
Powered by: newtelligence dasBlog 2.3.9074.18820
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, © Copyright 2010
E-mail