Search code examples
sql-server-ceinformation-schema

Sql Compact, determine ROWGUIDCOL


How does one determine ROWGUIDCOL property in a SQL Compact database?

Compact schema is exposed through INFORMATION_SCHEMA only, and as half expected, I'm having no luck finding Microsoft's proprietary ROWGUIDCOL property information inside.


Solution

  • This is the only (undocumented) way that I know of:

    SELECT column_flags, ... FROM information_schema.columns 
    

    If the value of column_flags is 378 or 282, the column is ROWGUIDCOL

    (You can also use my Scripting API to get this info, saves you writing SQL code)