Is it possible to create a GUID with a unique constraint?

Ian_LeonardIan_Leonard Member Posts: 3
edited 2004-08-01 in Navision Attain
We are using SQL Server 2000 and are having problems with Navision duplicating GUIDS. We need the guids to be unique to interface with an external system. We tried to modify the SQL table behind the scenes but when adding records PK violations kept happening forcing us to disable the additional Index with unique constraint.

We have been debugging code that handles the GUID but can't help thinking we're overworking the code and overlooking a function that could help us.

What tips or features should we be using to properly handle the GUIDs?

Comments

  • PrebenRasmussenPrebenRasmussen Member Posts: 137
    Are you using Navisions build-in CREATEGUID() function?
    I have never seen this create duplicate values.
  • Ian_LeonardIan_Leonard Member Posts: 3
    The duplicates were caused by code that copies records and doesn't handle the guid properly. We've been searching and fixing the code but tried to force the integrity with an index having a unique constraint. Navision didn't like the constraint when creating records. The records always get created with a 000-000 guid until our code saves the record. That means only one user can create at a time.

    The createguid function works fine. We can't get it to work as a default on the table though.
  • PrebenRasmussenPrebenRasmussen Member Posts: 137
    How about posting some code? It usually makes it easier to help...
Sign In or Register to comment.