Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure help 3

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
0
0
US
Hi all, i'm trying to create a stored procedure where I push all data from one table to another in the same dB.

This is what I have done so far:
Code:
CREATE PROCEDURE test1.sendtolive AS (
  insert into test2.dbo.Department_Info
  select * from Department_Info where Is_Live = 1
)

The above code should push ALL info from the Department_Info table from TEST1 dB to TEST2 dB. I am getting the following error:

Code:
Error 8101: An explicit value for the identity column in table 'test2.dbo.Department_info' can only be specified when a column list is used on IDENTITY_INSERT is ON.

I think that means I need to do something like:

SELECT @Department_Info_ID=@@identity
SELECT @Department_Info_ID AS Department_Info_ID


Is that right? If not, then any help would be great.

Thanks.

[sub]
____________________________________
Just Imagine.
[sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top