how to rest identity columns in sql server
Answers were Sorted based on User's Feedback
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 |
Answer / adhi
USE AdventureWorks;
GO
DBCC CHECKIDENT ("HumanResources.Employee", RESEED, 300);
GO
Is This Answer Correct ? | 2 Yes | 0 No |
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 |
Difference between sql server 2000 and sql server 2005?
11 Answers Aditi Tech, eInfochips, GE, HCL, IBM, Masim Infotech, NIIT, Satyam, Systems Domain,
What is the Disadvantage of indexed sequential file.
What are the two authentication modes in sql server?
Difference between writing SQL query and stored procedure ?
15 Answers Cognizant, Infosys, TCS, Veritas,
how to trace the traffic hitting a sql server? : Sql server database administration
Explain few examples of stored procedure over triggers?
Does sql server 2000 full-text search support clustering?
What is partition, how will you implement it? : sql server analysis services, ssas
How to get nth highest salary from employee table.
What do you mean by tablesample?
What is the difference between dropping a database and taking a database offline?
Does sql server use java?