Mayfield2268
Active member
- Joined
- Feb 24, 2003
- Messages
- 30
I have this sql insert statement below. I use a select statement to grab the values. The only problem is that I want to use @New_ID as a value to insert. Where it says SELECT New_ID, can I replace it with SELECT @New_ID?
Thanks
CREATE PROCEDURE dbo.DeletePersonMerge
@New_ID varchar (100),
@Deleted_New_ID varchar (100)
AS
INSERT INTO tblPersonInterests (New_ID, IC_ID, Mod_Date, Last_Changer)
SELECT New_ID, IC_ID, Mod_Date, Last_Changer FROM tblPersonInterests WHERE
New_ID = @Deleted_New_ID AND IC_ID NOT IN (SELECT ic_id FROM tblPersonInterests
WHERE New_ID = @New_ID)
Thanks
CREATE PROCEDURE dbo.DeletePersonMerge
@New_ID varchar (100),
@Deleted_New_ID varchar (100)
AS
INSERT INTO tblPersonInterests (New_ID, IC_ID, Mod_Date, Last_Changer)
SELECT New_ID, IC_ID, Mod_Date, Last_Changer FROM tblPersonInterests WHERE
New_ID = @Deleted_New_ID AND IC_ID NOT IN (SELECT ic_id FROM tblPersonInterests
WHERE New_ID = @New_ID)