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 |
What is database mirroring?
What type of locking occurs during the snapshot generation? : sql server replication
What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas
What is the difference RDBMS and Graph Database?
What is ACID Property of Transaction?
which is best institute to learn sql server in ameerpet or sr nagar or maithrivanam?please help
How you can change a cross join into an inner join?
Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?
What is catalog views?
What are the requirements to use odbc connections in php scripts?
what is package configuration variable?How to change file name in folder dynamically?Plz help me
What is the difference between cross join and Full outer join?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)