|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I’m new to triggers. Is there a website or other source of online information that explains them in detail that you know of?
I’m trying to create a trigger that updates a table in a second database, not a table in the same database, when the original database is edited. I’ve had a real problem getting connected between databases; it seems everything is geared to working on different tables in the same database. This is possible, isn’t it? Any help you could provide will be greatly appreciated. |
|
#2
|
|||
|
|||
|
Have you found any solution for your problem? Im in the same situation as you are. Would really appreciate if you could
pull me out of this. Please let me know, Thanks Quote:
|
|
#3
|
|||
|
|||
|
You need to reference the table in the other database as follows...
[TheOtherDatabaseName].[dbo].[NameOfTable] The [dbo] part is the name of the database owner of the table. I tried this with a delete trigger and it worked. |
|
#4
|
|||
|
|||
|
What about accessing a database from a different server?
Please suggest ! Thanks |
|
#5
|
|||
|
|||
|
To access a table (t2) from a database (d2) on server (s2), you may have to code something like this...
SELECT * FROM s2.d2.<owner>.t2 - you need port 1433 access to server-2 from server-1, if the servers are located on different domains with your organization and have firewall rules between those domains. - you need to define a "linked server" entry for s2 from s1. - You may need your DBA help to define "linked server" entry. Good Luck! |
|
#6
|
|||
|
|||
|
Thankyou. Ive figured out that I can't do that unless I configure my servers as linked servers.
I appreaciate your response. Thanks Nirupama |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Connecting to another DB in a Trigger |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|