Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Posts
    119

    Unanswered: Checking all tables that have a specific column name?

    Is there a command I can use to tell me all the tables in my schema that have a column name "Id"?

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT TABLE_SCHEMA, TABLE_NAME
       FROM INFORMATION_SCHEMA.COLUMNS
       WHERE  'id' = COLUMN_NAME
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Hmmmmm....why do you do it "backwards"?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I work regularly with langauges that get confused about assignment versus comparison. Only two of the languages I've ever dealt with allow you to assign a new value to a constant (in which case Wim would be sorely confused, because 2 very definitely CAN equal 3 there), and fortunately I don't have to work with either of those languages anymore.

    Consider my coding style to be an idiocyncracy of an old phart. You should try to do it backwards sometime... It can be fun!

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Quote Originally Posted by Pat Phelan View Post
    I work regularly with langauges that get confused about assignment versus comparison. Only two of the languages I've ever dealt with allow you to assign a new value to a constant (in which case Wim would be sorely confused, because 2 very definitely CAN equal 3 there), and fortunately I don't have to work with either of those languages anymore.
    Have adjusted my Signature.

    Quote Originally Posted by Pat Phelan View Post
    Consider my coding style to be an idiocyncracy of an old phart. You should try to do it backwards sometime... It can be fun!
    Backwards? You mean something like this?

    Consider my phart to be an idiocyncracy of an old coding style.

    "It can be fun!"
    Guess I need to practice more.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    No doubt about it Wim, that deserves yet another

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •