I used an Insert-trigger on the Table-A of the Database-A on Server-A. This trigger will put the Inserted-data into Table-B of the Database-B on Server-B.
I used an Insert-trigger on the Table-B of the Database-B on Server-B. This trigger uses the Inserted-data to calculate, and then insert the result in the Table-C of the Database-B on Server-B.
I used an Update-trigger on the Table-C of the Database-B on Server-B. This trigger used the Inserted-data to calculate, and then send mail automatically.
SQL Server now looks as if often deadlock. Is there any good solution?
Trigger on Table-A of Database-A on Server-A as below:
USE [Database-A]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[TRIGGER_INSERT_A]
ON [dbo].[Table-A]
FOR INSERT
AS
BEGIN
INSERT INTO [Server-B].[Database-B].[dbo].[Table-B] (
[Server-B].[dbo].[Table-B].[field1],
[Server-B].[dbo].[Table-B].[field2],
[Server-B].[dbo].[Table-B].[field3],
[Server-B].[dbo].[Table-B].[field4],
[Server-B].[dbo].[Table-B].[field5],
[Server-B].[dbo].[Table-B].[field6],
[Server-B].[dbo].[Table-B].[field7]
) SELECT
[field1],
[field2],
[field3],
[field4],
[field5],
[field6],
[field7]
FROM inserted
END
GO
Trigger on Table-B of Database-B on Server-B as below:
USE [Database-B]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[TRIGGER_INSERT_B]
ON [dbo].[Table-B]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
-- Logic portion is omitted
-- UPDATE [dbo].[Table-B] OR INSERT [dbo].[Table-B]
END
GO
Trigger on Table-C of Database-B on Server-B as below:
USE [Database-B]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TRIGGER_UPDATE_C]
ON [dbo].[Table-C]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @recipients VARCHAR(MAX)
DECLARE @subject NVARCHAR(255)
DECLARE @body NVARCHAR(MAX)
DECLARE @body_format VARCHAR(20)
DECLARE @importance VARCHAR(6)
DECLARE @sensitivity VARCHAR(12)
DECLARE @query NVARCHAR(MAX)
DECLARE @execute_query_database NVARCHAR(128)
DECLARE @attach_query_result_as_file BIT
DECLARE @query_attachment_filename NVARCHAR(260)
DECLARE @query_result_header BIT
DECLARE @query_result_width INT
DECLARE @query_result_separator CHAR(1)
DECLARE @exclude_query_output BIT
DECLARE @append_query_error BIT
DECLARE @query_no_truncate BIT
SELECT
@recipients = [recipients],
@subject = [subject],
@body = [body],
@body_format = [body_format],
@importance = [importance],
@sensitivity = [sensitivity]
FROM [dbo].[Table-D]
SET @query = 'query portion is omitted'
SET @execute_query_database = 'Database-B'
SET @attach_query_result_as_file = 1
SET @query_attachment_filename = 'Automatic alarm.txt'
SET @query_result_header = 1
SET @query_result_width = 256
SET @query_result_separator = ' '
SET @exclude_query_output = 0
SET @append_query_error = 0
SET @query_no_truncate = 0
-- UPDATE [dbo].[Table-C] here
EXEC [msdb].[dbo].[sp_send_dbmail]
@profile_name = 'profile_name',
@recipients = @recipients,
@subject = @subject,
@body = @body,
@body_format = @body_format,
@importance = @importance,
@sensitivity = @sensitivity,
@query = @query,
@execute_query_database = @execute_query_database,
@attach_query_result_as_file = @attach_query_result_as_file,
@query_attachment_filename = @query_attachment_filename,
@query_result_header = @query_result_header,
@query_result_width = @query_result_width,
@query_result_separator = @query_result_separator,
@exclude_query_output = @exclude_query_output,
@append_query_error = @append_query_error,
@query_no_truncate = @query_no_truncate
END
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問,美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。