Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Say if we have a table that contains only a single column ,
say OrderID, which has IDENTITY attribute defined on it. So
how can we insert data in this table.

I am reframing my question, that how can we make the table
to increment the column "OrderID" value several times???

Answers were Sorted based on User's Feedback



Say if we have a table that contains only a single column , say OrderID, which has IDENTITY attrib..

Answer / madhu

To insert values into Identity column use the
IDENTITY_INSERT option like

SET IDENTITY_INSERT Table_Name ON
Insert Table_Name
(OrderID)
Values(10)
SET IDENTITY_INSERT Table_Name OFF

Is This Answer Correct ?    4 Yes 0 No

Say if we have a table that contains only a single column , say OrderID, which has IDENTITY attrib..

Answer / brahma

create table t1(a int identity(1,1))
insert into t1 default value

set identity_insert t1 off
(or)
set identity_insert t1 on

Is This Answer Correct ?    0 Yes 0 No

Say if we have a table that contains only a single column , say OrderID, which has IDENTITY attrib..

Answer / deepak

Madhu, actually the answer which u have given is quite
common. Now i m gonna tell u a new one. The above question
has one more solution that is stated below:


"Insert into Table_name DEFAULT values"


that's it.

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL Server Interview Questions

Explain multiserver query

0 Answers  


What is the difference between for trigger and after trigger?

0 Answers  


where do you use Isolations?give me some exmpale?

1 Answers  


What triggers long term care?

0 Answers  


What is filestream?

0 Answers  


what is a correlated sub-query? : Sql server database administration

0 Answers  


Why use “nolock” in sql server?

0 Answers  


How to link up the text file to a Database table?

2 Answers   Allianz,


What is the difference between Drop and Truncate

20 Answers   GT Nexus, IBM,


How can you know if the row fetched from cursor is still valid in underlying table?

0 Answers  


How can you set the threshold at which sql server will generate keysets asynchronously?

0 Answers  


Where the sql logs gets stored? : sql server database administration

0 Answers  


Categories