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.
| Author |
Topic |
|
mshsilver
Posting Yak Master
112 Posts |
Posted - 2009-04-07 : 08:45:53
|
Hi,I am in a situation where I need to move data from one table into 3 other tables in the same database(SQL Server 2005). What would like to find out is the best way to achieve this. It will need to be done once a day and then the data from the source table will need to be deleted.I have been think of a stored procedure but am not sure exactly on the syntax so am yet to get that working. Before I take that route I thought some advice was needed.Any help would be greatly appreciated. Thanks in advance.Here is the test procedure I setup trying to move one field from a table to a field in another table. I did this just to test my code and the logic. Here is the error:Msg 201, Level 16, State 4, Procedure move_ebs, Line 0Procedure or function 'move_ebs' expects parameter '@forename', which was not supplied.set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOalter procedure [dbo].[move_ebs] @forename varchar(50) AS SET @forename = (select forename from wce_ilr where learning_aim = '10003265')INSERT INTO inserttest (forename) VALUES (@forename) |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-07 : 08:49:33
|
[code]alter procedure [dbo].[move_ebs]( @learning_aim VARCHAR(10) = '10003265')ASset nocount on INSERT inserttest ( forename )select forenamefrom wce_ilrwhere learning_aim = @learning_aim[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
mshsilver
Posting Yak Master
112 Posts |
Posted - 2009-04-07 : 12:11:24
|
| Thanks for that, worked straight away. |
 |
|
|
|
|
|