Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin



SQL Script: Search all tables for a specific field

DECLARE @NAME_TO_SEARCH_FOR nvarchar(50)

SET @NAME_TO_SEARCH_FOR = '%photo%'

SELECT sysobjects.name AS Table_Name, syscolumns.name AS Column_Name
FROM syscolumns INNER JOIN sysobjects ON syscolumns.id = sysobjects.id
WHERE syscolumns.name LIKE @NAME_TO_SEARCH_FOR AND sysobjects.Type Like 'U%'

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Friday, October 29, 2004 12:36 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Comments are closed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann