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

How will you know when statistics on a table are obsolete?

0 Answers  


Explain how to integrate the ssrs reports in application?

0 Answers  


Data is not being delivered to subscribers, what can be the possible reasons? : sql server replication

0 Answers  


You want to implement the one-to-one relationship while designing tables. How would you do it?

0 Answers  


Where to find ntwdblib.dll version 2000.80.194.0?

0 Answers  






what is cluster and nin-cluster index?

4 Answers  


What is the tcp/ip port on which sql server runs?

0 Answers  


Why we use trigger in sql server with example?

0 Answers  


How to connect php with different port numbers?

0 Answers  


What is Lock table in SQL?

0 Answers   Wipro,


How to write character string constants or literals in ms sql server?

0 Answers  


Hi Friends, I have a table in which there are thousands of records and in city field there is NULL value for all records now i want to change that null value with distinct values in each record say delhi, bihar, agra, jaipur etc, what will be the query for that????? its not possible to update thousands of records one by one. is there any alternative ...? Plz help ... its urgent Thanx in advance

1 Answers  


Categories