If we want to have a column where value should inserted automatically in incremented order, we can apply Identity on that column.By default we can not insert value manually in Identity column.
Step2:- Add an identity on column in existing table.
we can apply identity constraint on the column when table is already created.
Step3:- Insert valueS manually on identity column.
See it:-
Step4:- We can also apply identity constraint on column without SQL Commands.
first click eid column -> click Identity Specification-> now set is identity to YES .Which is shown below:-
see it:-
For More:-
To Get the Latest Free Updates Subscribe
click the below for download whole commands.
DOWNLOAD
SYNTAX:-
Identity (<seed> < Incremented >)
Step1:- Create the table and add an identity on the column.
create table emp3(eid int identity(0816113042,1),ename varchar(30), eage int)
Step2:- Add an identity on column in existing table.
- we can add identity column on the table,if an identity column already exist then we use following command.
alter table emp3 drop column eid
alter table emp3 add eid int identity(10,1)
ALTER TABLE emp ADD ToBeIdentity INT IDENTITY(1,1)
Step3:- Insert valueS manually on identity column.
set identity_insert emp3 on
--or
set identity_insert emp3 off
insert into emp3 (ename,eage)values('ram',23)
insert into emp3 (ename,eage)values('rajesh',25)
See it:-
Step4:- We can also apply identity constraint on column without SQL Commands.
first click eid column -> click Identity Specification-> now set is identity to YES .Which is shown below:-
see it:-
For More:-
- Ms Sql server
- Add Identity Column
- Delete and Truncate statement
- Stored Procedure and Function
- Collections
- Take Print receipt in Windows Form Application
To Get the Latest Free Updates Subscribe
click the below for download whole commands.
DOWNLOAD
0 comments:
Post a Comment