sql table with uniqueidentifier not showing as autoguid

  • 28 June 2021
  • 3 replies
  • 29 views

Badge +8

we have been using a sql database and have tables with uniqueidentifer set - K2 Smart object tester shows them as AutoGuid

we have another database that we have uniqueidentifier set, but K2 only shows as Guid

why isn't it shown as AutoGuid?


3 replies

Hello @braddo 


 


Thank you for your question. This is my opinion regarding your database structure. The reason for K2 displaying one table as a AutoGuid and the other as Guid could be related to the following issue. 


 


If you created an SQL table such as:


 


CREATE TABLE dbo.YourTable
(
SerialID UNIQUEIDENTIFIER PRIMARY KEY DEFAULT newsequentialid()
)


 


,and you create a smartobject from the table, it will display it as AutoGuid. 


 


Whereas, if you created a table such as:


 


CREATE TABLE dbo.YourTable
(
SerialID UNIQUEIDENTIFIER PRIMARY KEY DEFAULT
)


 


, it will display the field as Guid. The reason being that with a UniqueIdentifier, we can't autocrement like how we would for integers "identity(1,1)", so we would have to increment it by using "newsequentialid()" parameter. By adding this parameter, once we create a SmartObject, it will show that field as a AutoGuid (it takes on the role of an identity type field where a GUID will be auto generated when a record is created)


 


Hope this helps

Badge +8

Hi


that isn't the case


2 tables dfifferent databases have same properties


PK, uniqueidentifier, not null


(NewID())

Hi Braddo


 


I faced the same issue and found it to be a case of the service account lacking permissions in SQL.


 


K2 was unable to recognise that there was defaults applied against the column because it was unable to fully inspect the definitions.


 


-Kane

Reply