Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Cergy
    Posts
    65

    Question Unanswered: Query to know if a field exits in a table

    In MsSQLServer what is the query to kown if a field exists in a table

    if exist (select * from dbo.sysobjects where id =...............

    ????

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT *
       FROM INFORMATION_SCHEMA.COLUMNS
       WHERE 'MyTable' = TABLE_NAME
    -PatP

  3. #3
    Join Date
    May 2004
    Location
    Columbus, OH
    Posts
    59
    Code:
    select	1
    from	syscolumns
    where	ID = Object_ID ( '<table_name>' ) and
    		Name = '<field_name'
    bEH
    Life....Just another opportunity to live another day like a pirate....

Posting Permissions

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