建立觸發器

USE [DataServiceCenterDBNH]
GOip

/****** Object: Trigger [dbo].[insertAir2019] Script Date: 01/07/2019 17:34:58 ******/
SET ANSI_NULLS ON
GOci

SET QUOTED_IDENTIFIER ON
GO同步


-- ================================================
-- Template generated from Template Explorer using:
-- Create Trigger (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- See additional Create Trigger templates for more
-- examples of different Trigger statements.
--
-- This block of comments will not be included in
-- the definition of the function.
-- ================================================
-- =============================================
-- Author: <Author,符攸慶>
-- Create date: <Create Date,2018-12-12 20:30:50>
-- Description: <Description,空氣質量數據同步南海庫>
-- =============================================
CREATE TRIGGER [dbo].[insertAir2019]
ON [dbo].[Air_h_2019_M14999_Src]
AFTER insert
AS
BEGIN
declare @StationCode varchar(10), @TimePoint datetime, @PollutantCode varchar(5),@MonValue decimal(10, 3);
set @StationCode='A440605001';
select @TimePoint=TimePoint,@PollutantCode=PollutantCode,@MonValue=MonValue from insertedit

insert into [Skyland.MSC.NH].[dbo].[Air_h_2019_A440605001_Src]([StationCode]
,[TimePoint]
,[PollutantCode]
,[MonValue])
values(@StationCode,@TimePoint,@PollutantCode,@MonValue);
ENDio


GOfunction

相關文章
相關標籤/搜索