Difference between type and xtype fields in sysobjects

  • Can anyone tell me what the difference between the 'xtype' and the 'type' fields in sysobjects and syscolumns? I've noticed that there are several x??? columns in these tables.

    When querying these tables directly and I to assume that these pairs of fields will always contain the same values? If so, surely that's bad normalization!

     

    Thanks

    Ben

  • I am 90% sure that 'type' is to provide backward compatibilty to old versions of SQL Server. 

    xtype is the 'real' field that you want to use. 

  • Thank you Richard. Do you remember the source of this information so that I may confirm?

     

    Ben

  • No, I am sorry.  I don't recall where I found it.  I was working with version 7 at the time, using an old, old administrator's handbook I had and trying to build queries against the system tables.  The queries were not working due to the fact that my examples were using the 'type' field. 

    I did some hunting (I imagine I found a TechNet article) and adjusted my queries accordingly. 

    That was five or six years ago.  So I don't remember specifically where I found the information.  You might want to start at:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sys-o_4zll.asp
     

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

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