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 Full Text Search ?

1 Answers   TCS,


Your table has a large character field there are queries that use this field in their search clause what should you do?

0 Answers  


what is the information that can be stored inside a bit column? : Sql server database administration

0 Answers  


How do I start sql server 2017?

0 Answers  


How network traffic be reduced by using the stored procedure?

0 Answers   Accenture,






What is difference between delete and truncate commands?

0 Answers  


What are examples of triggers?

0 Answers  


Explain about sql server login?

0 Answers  


What is update locks?

0 Answers  


You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?

0 Answers  


How to use the inserted and deleted pseudo tables?

0 Answers  


How many .ndf files can we create in Sql server 2005?

2 Answers   Wipro,


Categories