Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I am trying to create a procedure that moves data across 2 tables. This SP works fine the way it is, the thing is there is a field in the destination table that does not exist in the source table. This field is called "SUBJECT" is there a way I can modify this SP so that this inserts the word "Transferred" in the SUBJECT field of the destination table? Also any critisism on the design of the SP, ie: should I be using transactions?Thanks again, MikeCREATE PROCEDURE [transfer_IM] ( @userID [int] )AS SET NOCOUNT ONINSERT into [tblMessage] ( [MessageFrom], [MessageTo], [Message], --[Subject], [date], [Checked]) SELECT messageFromID, messageToID, message, date, checked FROM tblInstantMessage WHERE checked ='0' AND messageToID = @userIDDELETE tblInstantMessage WHERE checked ='0' AND messageToID = @userIDGO
Page47
Master Smack Fu Yak Hacker
2878 Posts
Posted - 2002-06-11 : 15:29:57
CREATE PROCEDURE [transfer_IM] ( @userID [int] ) AS SET NOCOUNT ON INSERT into [tblMessage] ( [MessageFrom], [MessageTo], [Message], [Subject], [date], [Checked]) SELECT messageFromID, messageToID, message, 'Transferred', date, checked FROM tblInstantMessage WHERE checked ='0' AND messageToID = @userID DELETE tblInstantMessage WHERE checked ='0' AND messageToID = @userID GO