How do we differentiate between USer tables and System Tables in SQL Server

  • How do we differentiate between USer tables and System Tables in SQL Server

    Thanks

    Plz Reply ASAP

    Best Regards

    Anil Mahadev

    Software Dev 2 Da Max

  • How do you mean. There are many ways tables can be viewed and each has a specific way. FOr instanes if you are querying sysobjects in a db then use

     

    select * from sysobjects where xtype = 'u' and status > 0

  • To expand ever so slightly on Antares686's response -

    In sysobjects,

    xtype = 'u' is a user table

    xtype = 's' is a system table

    and sysobjects is a system table in each database that contains information about all of the "objects" in the database.

    Steve

  • Just and additional comment.

    The

    status > 0

    is added to cover items like dtproperties which is a system table but marked as a user table. All system objects have a bitmask applied that makes status a negative number which covers dtproperties as well.

  • Antares686,

    I did not know that, thank you!!!

    Steve

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

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