私はここで何かが分かりません。このトリガーは、テーブル内のすべての行を更新しています(強制終了のパフォーマンス)。新しい挿入行で更新を実行するだけです。トリガーが挿入されていないすべての行を更新します
CREATE TRIGGER [dbo].[update_location_topo_name]
--fires at each row insert, queries topo map layer (must be present!) and inserts name of topo into new location record
on [dbo].[TBL_LOCATIONS]
after insert
AS
BEGIN
update TBL_LOCATIONS
set TOPO_NAME = dbo.QD24K_GRSM.NAME
FROM dbo.tbl_locations
inner join dbo.QD24K_GRSM
on TBL_LOCATIONS.Location_ID = TBL_LOCATIONS.Location_ID
WHERE (QD24K_GRSM.Shape.STContains(TBL_LOCATIONS.SHAPE) = 1)
END
主キーと外部キーを含む 'QD24K_GRSM'と' tbl_locations'のためにあなたのテーブル構造を提供してください。 –
[リンク] http://stackoverflow.com/questions/9046436/can-stwithin-or-stcontains-be-used-to-update-columns-based-on-point-within-polyg [/ link] – tpcolson
objectid is両方のPK。 – tpcolson