dcsimg
Results 1 to 4 of 4

Thread: GUID Question

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,746

    GUID Question

    I was looking at a database that I may end up dealing with a bit, and noticed something odd. The DB is SQL Server 2014, and they use uniqueidentifier PKs (and some other keys), which would be a GUID, but it's not a normal GUID, in this case. For one thing, there are a large number of rows in one table that differ only by the first two characters. Furthermore, the M character (the first character of the second quartet) is E. That character should be the version, of which I am only aware of 1 through 5.

    Clearly this GUID is not being generated by the typical NewID() function in SQL Server, as that would generate a standard version 4 GUID. I don't have any experience with the NewSequentialID() method, though. Does that generate version E GUIDs? Does that generate GUIDs that differ only in the first byte?

    Interestingly, I also note that the table has a handful of Version 4 GUIDs, and one version E that is different from all the rest, but that's a different matter.
    My usual boring signature: Nothing

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,601

    Re: GUID Question

    Is the column an identity? Is it possible that these values are being generated externally to the database, e.g. multiple clients generating sequential values in different ranges to avoid collisions (even though that would somewhat defeat the purpose of using GUIDs in the first place)?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,746

    Re: GUID Question

    Absolutely anything is possible in this case. This project has me utterly baffled on many different levels, but mostly political. I can't decide whether they are brilliant, deranged, stalling for time, or a bit of all of the above. That's why I'm asking this question.

    There are several dozen database tables. While I haven't looked at all of them, I did notice that there doesn't appear to be much of a pattern in most of them. A large number of the GUIDs are just version 4, which makes it all the more strange that this one table is not using them...well, it is using version 4 for about half a dozen, but not for about three dozen. More peculiar, the table is a straight up pick list, where a GUID doesn't really gain anything.

    So, I guess what I'm really looking for is whether or not this version E could be generated by some MS process, or whether this is something home-grown?
    My usual boring signature: Nothing

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,406

    Re: GUID Question

    Long shot but, if I see something strange going on, in the database, i usually take a look at the triggers.
    Many times they are there, silently baffle the heck out of everyone using the db.
    Last edited by sapator; Sep 17th, 2018 at 04:23 AM.
    Slow as hell.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width