How to find a table existed or not?

  • In SQL 2000, there is a system table called sysobjects that contains table name in a database, which gives us info about a table existed or not. In SQL 2005, the system table is no there anymore. Is there a better way in SQL 2005 to detect table existed, ideally, from C# code?

  • Sorry I accidently post it twice. I tried to delete it but could not.

  • sysobjects still exists in SQL2005 as a migration, but is a VIEW

    - you can see it in SSMS under system views

    not sure if is still [will be] in SQL2008 as MS deprecated its usage

    programatically you can use SMO or WMI or plain ADO object models

    - or even ADOX if you use ADO (classic)

    HTH

  • "New" view, available in 2k5, is called sys.Objects and will likely be available in 2k8, as well.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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