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

What is not null constraint?

0 Answers  


What is database normalization?

7 Answers   Deloitte, Digicel, JPMorgan Chase, Verifone,


what purpose does the model database serve? : Sql server database administration

0 Answers  


Can an entity have two primary keys?

0 Answers  


How can you swap values between two rows in a table using single- SQL statement?

1 Answers   Tavant Technologies, Virtusa,






what is hash nonclustered index

0 Answers  


How to Insert multiple rows with a single insert statement?

0 Answers  


What is a table called, if it has neither cluster nor non-cluster index? What is it used for?

0 Answers  


What is a trigger and types of a trigger?

0 Answers  


What is the use of Port no?

1 Answers   Wipro,


how can you attach more than 20 ldf files in sql server

0 Answers   IBM,


Is mysql the same as sql server?

0 Answers  


Categories