Hi
I have a table1 which hold a field (amount) with 1000 rows
The amount in the 1000 rows is consumed by clients during the day
The next day the amounts have to return to their original values (at this
time I’m doing that by hand)
Now I’m going to save the original values in another table
My question is: Can the SQL server copy the original values from table1 to
table2 at midnight or at a time I schedule?
Thks again.Yes. Create a SQL Agent job. Make sure the SQLSERVERAGENT service is set t
o
Automatic.
"Kenny M." wrote:
> Hi
> I have a table1 which hold a field (amount) with 1000 rows
> The amount in the 1000 rows is consumed by clients during the day
> The next day the amounts have to return to their original values (at this
> time I’m doing that by hand)
> Now I’m going to save the original values in another table
> My question is: Can the SQL server copy the original values from table1 to
> table2 at midnight or at a time I schedule?
> Thks again.
>|||Insert them into a new table
1.INSERT INTO NewTableName
Select * From OldTableName
2.Update the Working table (at night after the work) with a update statement
referencing the ID column of the table
BEGIN Transaction
DELETE FROM Oldtable where ID IN (Select IDCOLUMN From NewTable)
INSERT INTO Oldtable SELECT * from NewTable
IF @.@.ERROR = 0
COMMIT
ELSE
ROLLBACK
Is it that what you ment ?
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Kenny M." <KennyM@.discussions.microsoft.com> schrieb im Newsbeitrag
news:D19D255D-E863-4E71-8E53-2145187103A7@.microsoft.com...
> Hi
> I have a table1 which hold a field (amount) with 1000 rows
> The amount in the 1000 rows is consumed by clients during the day
> The next day the amounts have to return to their original values (at this
> time I'm doing that by hand)
> Now I'm going to save the original values in another table
> My question is: Can the SQL server copy the original values from table1 to
> table2 at midnight or at a time I schedule?
> Thks again.
>
Thursday, February 9, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment