Thursday, February 16, 2012

Append Data

Hi,
Appreciated it if someone could help me with regards to
the abovesaid problem.
I don't know how to append data using SQL Query Analyzer
from table a to table b because it will create duplicate
table b.recordnumber(auto number) in table b. I tried to
use DTS but failed due to the duplicate record number(auto
number).
tq.
Hi,
Use "SET IDENTITY_INSERT" to allow explicit values in acolumn with identity.
See SET IDENTITY_INSERT in books online. There is good example as well which
shows the usage.
Sample:-
create table id1(i int identity, k char(10))
create table id2(i int identity, k char(10))
go
insert into id1(K) values('hari')
insert into id2(K) values('raj')
go
select * from id1
select * from id2
go
set identity_insert id1 on
insert into id2(k) select k from id1
go
select * from id2
Thanks
Hari
MCDBA
"GW" <anonymous@.discussions.microsoft.com> wrote in message
news:657801c4753d$a64178e0$a501280a@.phx.gbl...
> Hi,
> Appreciated it if someone could help me with regards to
> the abovesaid problem.
> I don't know how to append data using SQL Query Analyzer
> from table a to table b because it will create duplicate
> table b.recordnumber(auto number) in table b. I tried to
> use DTS but failed due to the duplicate record number(auto
> number).
> tq.

No comments:

Post a Comment