From: Chris Farrell <chris@cf...> - 2004-01-08 04:10:31
Working on this new module. I am certain there has to be a better way.
Task: Trying to take an existing record in a table and basically duplicate
only the ModuleID and thus copying a item from one module to another.
I can do it in a non generic way by declaring a variable for every field
except the one being
changed and the identity, and then doing a query to set those values and
Looking for a function or whatever that will be more generic and thus
something I can copy/paste
that will work for any of the modules.
Example of what I have now, this one copies an announcements item at the
end of this email.
NOTE!!!!!!!!I removed some of it to make it shorter!
I also need a way to copy multiple items in one swoop. Basically copy all
from one ModuleID
to another ModuleID changing only that field.
CREATE PROCEDURE rb_Announcements_CopyItem
@ItemID int, /*Item that will be copied*/
@TargetModuleID int /*Where to copy it to*/
DECLARE @CreatedByUser nvarchar(100)
DECLARE @CreatedDate datetime
@CreatedByUser = CreatedByUser,
@CreatedDate = CreatedDate,
ItemID = @ItemID
INSERT INTO rb_Announcements_st(