Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:45:56+00:00 2026-05-29T11:45:56+00:00

I have a database with 100 tables. how can i know which table contain

  • 0

I have a database with 100 tables.
how can i know which table contain a particular text.

For example which table contains text ‘Assumed Life Claims’

I can give a hint that this filed is a varchar

SQL SERVER 2008

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:45:57+00:00Added an answer on May 29, 2026 at 11:45 am

    ypercube’s suggestion is exactly correct. Here is an implementation:

    DECLARE @searchText VARCHAR(100)
    SET @searchText = 'Assumed Life Claims'
    
    DECLARE @sqlText VARCHAR(8000)
    DECLARE @MaxId INT
    DECLARE @CurId INT
    DECLARE @possibleColumns TABLE (Id INT IDENTITY(1, 1) NOT NULL PRIMARY KEY
                                   ,sqlText VARCHAR(8000))
    INSERT INTO @possibleColumns(sqlText)
    SELECT 'IF EXISTS (SELECT * FROM ' + c.TABLE_NAME + ' WHERE ' + c.COLUMN_NAME + ' = ''' + @searchText + ''') PRINT '' searchText=' + @searchText + ' was found in ' + c.TABLE_NAME + '.' + c.COLUMN_NAME + ''''
      FROM INFORMATION_SCHEMA.COLUMNS c
        -- Using hint that this field is a varchar
     WHERE c.DATA_TYPE = 'varchar'
    
    SELECT @CurId = MIN(pc.Id)
           ,@MaxId = MAX(pc.Id)
      FROM @possibleColumns pc
    
    WHILE (@CurId <= @MaxId)
    BEGIN
        SELECT @sqlText = pc.sqlText
          FROM @possibleColumns pc
         WHERE pc.Id = @CurId
    
        -- For testing (uncomment)
        --PRINT @sqlText
    
        EXEC(@sqlText)
    
        -- Increment counter
        SET @CurId = @CurId + 1
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge database with some 100 tables and some 250 stored procedures.
I have a huge database with 100's of tables and stored procedures. Using SQL
I have database with many tables. In the first table, I have a field
I have a database which is 6GB in size, with a multitude of tables
I have tables in a MySQL database like this... CREATE TABLE `someUserTable` ( userId
We have a live MySQL database that is 99% INSERTs, around 100 per second.
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have quite a few situations where I have database structures similar to: TABLE
I have a database that contains a date and we are using the MaskedEditExtender
I have an application using a MySql database which is displaying a paginated list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.