anjumathi kumar

anjumathi kumar

  • NA
  • 54
  • 64.2k

How to insert my values to identity and non identity field using single query

Jun 24 2011 6:19 AM
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?

Answers (1)