HKFuey
asked on
SQL Trigger selecting another database
I have a trigger to email me when a field changes in one table. I want it to use an email address from a table in another database, how do I do this?
Variables are these: @Rep varchar(20), @Sord varchar(20)
@Sord is taken from the table that is being changed in the current database.
This is the line that does not work: -
set @Rep = isnull((Select Salesperson from SERVER.dbName.dbo.Table
where SalesOrder = @Sord),'None')
It returns 'None' even though I know the data exists in the other database.
Can anyone help?
Variables are these: @Rep varchar(20), @Sord varchar(20)
@Sord is taken from the table that is being changed in the current database.
This is the line that does not work: -
set @Rep = isnull((Select Salesperson from SERVER.dbName.dbo.Table
where SalesOrder = @Sord),'None')
It returns 'None' even though I know the data exists in the other database.
Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for speedy response!!
Cheers