Posts

Showing posts from November, 2019

SQL Server Identity with different possible operation on it.

Image
Hello folks,       I dentity column is very common in database design when we want to add a column as id and auto increment by itself. Some time this same feature is known as auto increment in different database(e.g. MYSQL).  Basically id column is if set as identity(auto increment), is automatically managed and increased by itself when new record(s) are inserted. So, get started with creating a new table in sql server with identity column. Either you can use sql query for this, CREATE TABLE tbl_person ( id INT IDENTITY (1, 1) PRIMARY KEY, name VARCHAR (255) NOT NULL, ); or you can use sql server management studio tool for this. You can set identity option for a column as shown in above screenshot. Here, you can set initial seed(first parameter in sql query) and increment seed (second parameter in sql query). On Successfully creation of table if we try to insert identity column column field explicitly the MSSQL server throws an error stating