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 are different types of raid configurations? : Sql server database administration

0 Answers  


Describe how to use the linked server?

0 Answers  


What are the types of indexes available with SQL Server?

2 Answers   Standard Bank,


You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?

0 Answers  


What is the function of sql server agent windows service?

0 Answers  






What is a unique key constraint?

0 Answers  


Can XML be used to access data?

2 Answers  


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

0 Answers   Facebook,


What is sql server 2000 work load governor?

0 Answers  


How to set a database state to offline in ms sql server?

0 Answers  


What is sub-query in sql server?

0 Answers  


Explain indexed views and partitioned view with their syntax.

0 Answers  


Categories