Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute a Procedure from another database 2

Status
Not open for further replies.

rkolosky

Programmer
Nov 10, 2005
7
US
I have two databases, one that is being used as forum software for a web application and another in-house application to manage addresses.

I would like to be able to propogate changes from the address application out to the forum application.

On the address application, I put a trigger on insert:

CREATE TRIGGER TACAA_ins
ON dbo.TACAA
FOR INSERT
AS
DECLARE @title varchar(20),
@FName varchar(25),
@LName varchar(25),
@Email varchar(255),
@Passwd varchar(255)

SELECT @title = (SELECT title FROM Inserted)

IF @title = 'Administrator'
use PForums
go
exec Forum.pr_Members_INS_UPD
@Username = @Email,
@Password = @Passwd,
@FirstName = @FName,
@LastName = @LName,
@Email = @Email

But SQL Server says it can't find the PForums.pr_Members_INS_UPD.

Can triggers/stored procedures call one another when they're not in the same database? If not, what would be the better solution?
 
You'll also want to remove the USE command from within the trigger.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top