find record

  • i want to use query analyser to find all instances of the number 2855 in a database called sales so i know in what tables this value is referenced. what would be the correct syntax of this query?

  • If you name the column it would appear in the same on all tables then you can quickly do like so.

    sp_MSForEachTable '

    PRINT ''?'' --For easy reference.

    SELECT * FROM ? WHERE column_name = 2855'

    If not then you will have to write a query specific to each table.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Is the number a column name or in a row in the table? If it's in a row, is it always in the same column name?

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

  • its in a table called orders with the column called ordernum. i need to find all references to 2855 in the in the ordernum coulumn in the orders table in the sales db

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply