Friday, July 19, 2024

MS-SQL Server - Gap in the Identity

Gap in the Identity


https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property?view=sql-server-ver16


"Consecutive values after server restart or other failures - SQL Server might cache identity values for performance reasons and some of the assigned values can be lost during a database failure or server restart. This can result in gaps in the identity value upon insert."


Additionally,


Cap Memory


https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options?view=sql-server-ver16


XDES_SNAPSHOT


Any query will be considered.




T. Amit Vaid S.

1 comment:

Anonymous said...

Like Operator

Use Durgapurhospitals;

Select * from patientregistration where registrationnumber=0013681 and fname like 'amit%'

Case Example...

USE AdventureWorks2022;
GO

SELECT ProductNumber,
Category = CASE ProductLine
WHEN 'R' THEN 'Road'
WHEN 'M' THEN 'Mountain'
WHEN 'T' THEN 'Touring'
WHEN 'S' THEN 'Other sale items'
ELSE 'Not for sale'
END,
Name
FROM Production.Product
ORDER BY ProductNumber;
GO

Refer article...
https://learn.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-ver16

Additionally,

Keys and Constraints, Identity, Joins and Aggregate Functions