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)
 Trigger/Updates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-04 : 22:30:55
Mayday writes "I am trying to update data from Table 3 into multiple tables both tables reside in seperate databases but on same server.(Using update/trigger) Here is my schema.(This does not reflect my actual design)

Table1:
id | Firstname | Lastname | HomePhone
1 User1 Lastuser1 11111111
2 User2 Lastuser2 11111111

Table2:
id | Address | Email | AltEmail
1 111 drive @yahoo @hotmail
2 222 drive @lycos @iwon

Table3:
id | fldname | dbname | tblname |
1 Firstname db Table1
1 Address db Table2
2 Lastname db Table1
2 Email db Table2


I am new to SQL programming so please bare with me. How can I update the data from table3 when the actual field names do not match the field names in the other tables? I know that I could do a table.field = table.field but because the actual table names are records in the field I am having some difficulty. Also, I want to some how check to make sure that the values in the other tables that need updating are already current with the values in my holding table. I would assume that doing so will make my trigger and code more efficient rather than always updating the values in table3 into all other referencing tables regardless(I have many tables and fields out the wazoo). I hope all this made sense.


Appreciate any help

thanks,"
   

- Advertisement -