1

I am trying to create a table with the below syntax on Azure SQL DB and it is throwing the below error.

Can any one tell me why NEWSEQUENTIALID() is not allowed here. When I'm creating the same on on-premise server, its working fine.

Is there any replacement to NEWSEQUENTIALID().?

Table:

CREATE TABLE #SampleTable
  (  
   StoreGUID UNIQUEIDENTIFIER  DEFAULT (NEWSEQUENTIALID()),   
   AddressGUID  UNIQUEIDENTIFIER DEFAULT (NEWSEQUENTIALID()) 
  )  

Error:

Msg 104162, Level 16, State 1, Line 1 'NEWSEQUENTIALID' is not a recognized built-in function name.

TheGameiswar
  • 27,855
  • 8
  • 56
  • 94
ravi kiran
  • 371
  • 1
  • 5
  • 17

1 Answers1

2

Azure SQL Data Warehouse does not support NEWSEQUENTIALID at this time, as documented here in the Unsupported system functions section:

https://learn.microsoft.com/en-us/azure/sql-data-warehouse/sql-data-warehouse-migrate-code

If you genuinely require this function consider making a feature request here:

https://feedback.azure.com/forums/307516-sql-data-warehouse

But as an aside, I am not sure why you would want these in a distributed system - they don't make sense. In Azure SQL Data Warehouse you either distribute by ROUND_ROBIN in which case the GUID being sequential is irrelevant, or by HASHing on a column; there is no guarantee the hashing algorithm keeps your supposedly sequential GUIDs together once hashed. As a workaround, you could pre-generate say a few billion of them on a normal SQL Server box and import them to your DW for use later.

wBob
  • 13,710
  • 3
  • 20
  • 37