有名なブロガーによって書かれたレプリケーション スクリプトの一部を使用しています。以下にリストした部分に、1行しか保持しないまったく別のテーブルからさらに1列を追加したいと思います。基本的に、単一行のテーブルにはサイト名があり、そのテーブルのサイト名をこの INSERT INTO の一部として入力する必要があります。
SQL 2005 で OUTER APPLY が導入されたことは知っていますが、それが最善の方法であるかどうかはわかりません。どんな提案も大歓迎です。ありがとう。
Insert Into dbo.dba_replicationMonitor
(
monitorDate
, publicationName
, publicationDB
, iteration
, tracer_id
, distributor_latency
, subscriber
, subscriber_db
, subscriber_latency
, overall_latency
, SiteNameFromSiteInfoTable --Need to add this
)
Select
@currentDateTime
, @publicationToTest
, @publicationDB
, iteration
, tracer_id
, IsNull(distributor_latency, 0)
, subscriber
, subscriber_db
, IsNull(subscriber_latency, 0)
, IsNull(overall_latency,
IsNull(distributor_latency, 0) + IsNull(subscriber_latency, 0
)
, sitename = 'SELECT sitename FROM tblSiteInfo' --need this query to insert as well
)
From @tokenResults;
変数を考えていましたが、変数を渡すだけでは十分ではないと思います。どんな助けでも大歓迎です。ありがとう。