Sysobjects xtype vs. type

  • Can anyone tell me if either the xtype or type field is one that should be used predominantly?  They appear to contain identical information except that xtype includes a value of "UQ" for Unique Constraint.

    Over the years I've seen both used a lot.  They appear to be largely interchangeable but I'm wondering if one is better to use for any reason.

    Thanks.

  • i'd have to agree with you, with the exception of referencing PK's:

    select * from sysobjects where xtype <> type

    XTYPE of 'PK' <> TYPE of 'K' was the only difference i could find, so generally i'd agree they were interchangable; maybe someone else will have another answer.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • xtype is what should be used. type is included for backward compatability.

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

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