From my personal experience guids may affect the performance significantly if they are used for primary key and are randomly generated. To solve this i've read somewhere that is recommended to use NEWSEQUENTIALID() as default, instead NEWID() to generate keys and with clustered indexes the performances will be much better. However if I use these keys as foreign key in other table this will not help as they will not be ordered, so I choose to use integers for primary key. The idea is MSSQL to generate new id and to return it to object in code, but also I've read there might be some problems with using @@IDENTITY or SCOPE_IDENTITY()
I
Igor Jas
@Igor Jas
Posts
-
How to recover identity ID after insert in MSSQL 2008? -
How to recover identity ID after insert in MSSQL 2008?ty about the article. It really helped.
-
How to recover identity ID after insert in MSSQL 2008?I've been searching the net for this but I couldn't find concrete answer what to use to recover identity ID from INSERT stored procedure. What is the correct way to get the ID as output in stored procedure (should I use @@IDENTITY, SCOPE_IDENTITY() or something else). CREATE TABLE [dbo].[tbl_Table]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](50) NULL ) Thanks,