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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Querying all database columns for a value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-26 : 11:17:54
Stu writes "I'm working on some data cleansing and am trying to query all columns in the database for instances where a dummy value has been entered. For example spaces or dashes instead of null.

I want results to be returned as follows:

Table_NameA,Column_Name1,Y_N
Table_NameA,Column_Name2,Y_N
Table_NameA,Column_Name3,Y_N
Table_NameB,Column_Name1,Y_N
Table_NameB,Column_Name2,Y_N
Table_NameC,Column_Name1,Y_N

where Y_N indicates whether or not value was found (Y - dummy exists, N - dummy does not exist).

Initially i tried to create a cursor within a cursor, within a cursor... but with no sucess. I read everywhere of people doing this, but nowhere can i find the explanation."

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-08-26 : 11:49:40
This should do the job
[url]http://www.users.drew.edu/skass/sql/SearchAllTables.sql.txt[/url]

HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -