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
 Transact-SQL (2000)
 Updating transactions

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2005-12-12 : 13:44:48
How can I update in an specified order like updating an transactions based on the created date.

Example :-
Table 1
--------
Emp_id create_date amount due_date description
123 12/10/2005 200 test
123 12/11/2005 300 12/30/2005
123 12/12/2005 500

Table 2
---------
Emp_id create_date amount due_date description
123 12/09/2005 100 12/25/2005 Check


Here when I update table2 with the table1 contents it should update based on the create date basically update records sequentially on the create date and results should be like

Table 2
---------
Emp_id create_date amount due_date description
123 12/12/2005 500 12/30/2005 test



druer
Constraint Violating Yak Guru

314 Posts

Posted - 2005-12-12 : 13:58:23
update table
set field = new value
where table.datefile < date criteria

Update Table2
set table2.Field = table1.FieldValue
from Table2 inner join Table1 on Table1.KeyField = Table2.KeyField
where Table1.field = desired value
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2005-12-12 : 14:02:51
Update Table2
set table2.Field = table1.FieldValue
from Table2 inner join Table1 on Table1.KeyField = Table2.KeyField
where Table1.field = desired value

How will this update the records starting from 12/10/2005 through 12/12/2005 in order
Go to Top of Page
   

- Advertisement -