Larry Brister

asked on

# Copy into table with identity insert

How can I run the code below with identity insert when I copy from the...BU to live?

delete from proc_cfa.dbo.P_AvailableForSale

Select * into proc_cfa.dbo.P_AvailableForSale

from proc_cfa.dbo.P_AvailableForSaleBU

delete from proc_cfa.dbo.P_AvailableFo

Select * into proc_cfa.dbo.P_AvailableFo

from proc_cfa.dbo.P_AvailableFo

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Perfect...thanks

Here is the set of queries:

delete from proc_cfa.dbo.P_AvailableForSale

SET IDENTITY_INSERT proc_cfa.dbo.P_AvailableForSale ON

Select * into proc_cfa.dbo.P_AvailableForSale

from proc_cfa.dbo.P_AvailableForSaleBU

SET IDENTITY_INSERT proc_cfa.dbo.P_AvailableForSaleOFF

Note that there is "_" in indetity_insert.

delete from proc_cfa.dbo.P_AvailableFo

SET IDENTITY_INSERT proc_cfa.dbo.P_AvailableFo

Select * into proc_cfa.dbo.P_AvailableFo

from proc_cfa.dbo.P_AvailableFo

SET IDENTITY_INSERT proc_cfa.dbo.P_AvailableFo

Note that there is "_" in indetity_insert.

insert into myTable values (...);

SET IDENTITY INSERT myTable OFF;