SQL Notification query with linked server


  • Hi,

    I was wondering if someone could advise on my scenario.

    I have SQL Notification setup on a database called transfer_db. This is a log file thats updated by an application when a new file arrives.
    I have a basic SELECT as the notification query (in using System.Data.SqlClient.SqlDependency) which populates a DataGrid with the selected columns from the query.

    I would like to include the customer name within this DataGrid - this value is held in another database on another server though. In addition, to find the customer I have to join a field called username in the user_db database (on the same server as the notification database\table)

    The following query should demonstrate this:


    select c.finish_Time, c.file_name, c.transfer_time, a.company_name
    FROM customer_db.Customer_Records a, SQLSVR02.user_db.dbo.account_table b, SQLSVR02.transfer_db.dbo.transfer_log c 
    WHERE a.ID = b.CustomerID AND b.username = c.username


    How would I fit this in with SQL Notification? Can the notification query contain a linked server?


    My current setup is roughly:


    Thanks in advance

    viernes, 28 de enero de 2011 0:11

Todas las respuestas