SQL2000 Script Help

Associate
Joined
3 Feb 2003
Posts
1,771
Location
Sydney, Australia
Hi guys,

This is probably a very easy question for you pro's but I'm relatively new to SQL scripts.

I've created and inserted a new table in my database which contains a column of identifiers (trx_ctrl_num) and a column with dates in it (date_doc).

There are 3 tables already in the database that I need to update dates on.

Each of these contain the unique identifier column (trx_ctrl_num) in my table as well as a column with (date_doc) and another with (apply_doc).

I need a script that will update the date_doc and apply_doc with the date_doc on my new table where the trx_ctrl_num is the same as the one on my new table.


Hehe, I may need some other scripts later so if you know this one keep checking up :)
 
I need a script that will update the date_doc and apply_doc with the date_doc on my new table where the trx_ctrl_num is the same as the one on my new table.

I think this should do what you want:

Code:
UPDATE OldTable set date_doc = NewTable.date_doc, apply_doc = NewTable.date_doc
FROM OldTable, NewTable
WHERE OldTable.trx_ctrl_num = NewTable.trx_ctrl_num

You'll need to run this three times, changing "OldTable" to the name of each of your old tables.
 
Back
Top Bottom