Click here to Skip to main content
16,014,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
use regimen SET IDENTITY_INSERT data ON insert into data (firstname,lastname,quantity,rollno) values ('yLMdxMRqUuwCWQMzfXeqhdymQDOaiBKSvYLUBigGHLfYHKwof','hEezSvnAnUYRgsKDhYeSXWQxJwXz','858437.74','98834') SET IDENTITY_INSERT data OFF

Hi this is my problem:

Here am randomly inserting strings and integer to the fields in the column.
like that while am inseting integer if the integer field is Identity(auto increment)]mean this query works perfect

but the fiels is not an identity(auto increment) mean it not work i got error not able to perform set opertation nu...so i want to insert integer for both Identity and non identity fields how to do that?

if i wantto insert identity field want to perform set operation on and off
non identity field no need to perform set operation

how to use both work in single query?how to modify my query?

anybody say the correct query for dynamically passingIinserting) integer for an identity and non identity fields?
Posted
Updated 23-Jun-11 23:15pm
v2

1 solution

You're trying to turn off identity. If you don't know if your fields are identity fields or not, then you really don't know enough about the DB to be updating it. Why have identity fields if you're going to routinely change them ? What are you trying to do ?
 
Share this answer
 
Comments
suryaswathi 24-Jun-11 6:02am    
i want to insert my value in the integer field if its identity and non identity both i want to insert...thers is a possible way to insert?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900