Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 15th, 2002, 01:32 PM
RVoigt RVoigt is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Annapolis MD
Posts: 1 RVoigt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Connecting to another DB in a Trigger

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.

Reply With Quote
  #2  
Old March 18th, 2004, 11:52 AM
nynd nynd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 nynd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Originally Posted by RVoigt
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.

Reply With Quote
  #3  
Old March 22nd, 2004, 07:04 AM
QWERTY QWERTY is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 QWERTY User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m
Reputation Power: 0
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.

Reply With Quote
  #4  
Old March 23rd, 2004, 12:12 PM
nynd nynd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 nynd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What about accessing a database from a different server?
Please suggest !
Thanks

Reply With Quote
  #5  
Old March 31st, 2004, 01:11 PM
sqldba1 sqldba1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 sqldba1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

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!

Reply With Quote
  #6  
Old April 9th, 2004, 02:21 PM
nynd nynd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 nynd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thankyou. Ive figured out that I can't do that unless I configure my servers as linked servers.
I appreaciate your response.
Thanks
Nirupama

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Connecting to another DB in a Trigger


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway