Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
walwinkle
Starting Member
6 Posts |
Posted - 2012-03-01 : 19:59:34
|
I am in the process of migrating data from our current data structure to a new different data structure. We will be using replication so all the primary keys are GUID's I have also set the default value to NEWSEQUENTIALID() for performance and indexing purposes.I am currently writing SQL scripts to transfer the data. I need to know the primary key of the record I am adding as I will be using it as a foreign key in the same script so I have been using NEWID() to generate this value 'SET @SomeKey = NEWID()'. This however means that my primary keys will not be sequential for the migrated data.Will this have a performance impact and essentially make using the NEWSEQUENTIALID() redundant?I have a workaround for generating sequential id's. Create a temp table (id INT, SomeSEQUENTIALID GUID), populate it with any number of sequential id's, select TOP 1 SomeSEQUENTIALID FROM tbl_sequentialIds ORDER BY Id ASC.Once I select my SomeSEQUENTIALID, I delete the record so it cannot be used again.Any thoughts on this?Thanks |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
|
|
|
|