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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 moving data across tables

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2002-06-11 : 15:05:45

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,
Mike



CREATE PROCEDURE [transfer_IM]
(
@userID [int]
)

AS SET NOCOUNT ON

INSERT into [tblMessage]
(
[MessageFrom],
[MessageTo],
[Message],

--[Subject],
[date],
[Checked])

SELECT messageFromID, messageToID, message, date, checked FROM tblInstantMessage WHERE checked ='0' AND messageToID = @userID

DELETE tblInstantMessage WHERE checked ='0' AND messageToID = @userID



GO






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

 


<O>
Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2002-06-11 : 17:42:00
excellent thank you!

Go to Top of Page
   

- Advertisement -