how to rest identity columns in sql server

Answers were Sorted based on User's Feedback



how to rest identity columns in sql server..

Answer / muthu kumar

create table t(id int identity(seed,increment))

where seed is starting number and increment is number to be
incremented.

create table t(id int identity(1,1),name varchar(50))

so the id will be start with 1 and will be incremented 1 by
1 each time when record is get insered

Is This Answer Correct ?    5 Yes 0 No

how to rest identity columns in sql server..

Answer / adhi

USE AdventureWorks;
GO
DBCC CHECKIDENT ("HumanResources.Employee", RESEED, 300);
GO

Is This Answer Correct ?    2 Yes 0 No

how to rest identity columns in sql server..

Answer / yvbchowdary

The identity is similar to squence object in oracle. syntax
for identity column is
<column-name> <data type> identity(start value,increment)
ex:
empno int identity(100,2)

suppose if u want to add an odd value i.e, 50; u can also
add
first execute IDENTITY_INSERT ON
and then u can insert whatever values u want. then again
execute IDENTITY_INSERT OFF

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Can sql servers link to other servers?

0 Answers  


what is memory-optimized nonclustered indexes

0 Answers  


Write a query to get all details of employee who has maximum salary from employee table

8 Answers   AON, Genpact,


What is the basic difference between clustered and a non-clustered index?

9 Answers   Infogain,


How can i change the column name.

13 Answers   HCL, Yardi Software,


Can you explain different types of joins?

0 Answers  


What are partitioned views?

0 Answers  


What are joins in sql and what are the different types of joins?

0 Answers  


what is datawarehouse?

0 Answers   Informatica,


Which tcp/ip port does sql server run on? How can it be changed?

0 Answers  


difference between truncate, delete aur drop?

2 Answers  


Why should one not prefix user stored procedures with ‘sp_’?

0 Answers  


Categories