Skip to main content
Inspiring
November 10, 2008
解決済み

How to check on database table existence?

  • November 10, 2008
  • 返信数 2.
  • 475 ビュー
I want to check if a certain database table exists, if so run code / display message etc.
so not if the table holds data or not, but if it is in the database.

Any idea's?

Thanks!
    このトピックへの返信は締め切られました。
    解決に役立った回答 Dan_Bracuk
    figure out a way to query the system tables, assuming you have permission to do so. The details are db specific.

    返信数 2

    November 14, 2008
    if it's Sybase and this might work in MS SQL as well

    select count(name) as tablecount from thedatabasename..sysobjects where type = 'U' and name = 'thetablename'
    Dan_Bracuk解決!
    Inspiring
    November 10, 2008
    figure out a way to query the system tables, assuming you have permission to do so. The details are db specific.