今天遇到乙個問題,原有生產系統正在健康執行,現需要監控一張資料表,當增加資料的時候,給管理員傳送郵件。
領到這個需求後,有同事提供方案:寫觸發器觸發外部應用程式。這是個大膽的想法啊,從來沒寫過這樣的觸發器。
以下是參考文章:
第一種方法:觸發器呼叫外部程式。 xp_cmdshell
第一篇提供的方法是需要開啟xp_cmdshell
先開啟xp_cmdshell
。
create trigger tri_emailon [dbo].[imagegalleries]
after insert
as begin
if exists(select * from inserted)
begin
declare @content nvarchar(max)
select @content=i.name+'|'+i.imagepath from inserted i;
exec msdb.dbo.sp_send_dbmail @profile_name='sqlprofile',
@subject='sql server send email by trigger',
@body=@content
endendgo
Execl資料匯入Sql Server表
將execl資料放入dataset public dataset execleds string filenameurl,string table 匯入按鈕事件 protected void button1 click object sender,eventargs e string isxls s...
SQL Server資料型別表
表1 sql server2000欄位資料型別縮寫表 字段資料型別 縮寫含義 sql variant sv儲存不同資料型別的值 數值型 integer int整數值,用4個位元組來儲存 bigint bint 整數值,用8個位元組來儲存。資料值儲存範圍 263 263 smallint sint 整...
SQLServer恢復表級資料
原文 sqlserver恢復表級資料 最近幾天,公司的技術維護人員頻繁讓我恢復資料庫,因為他們總是少了where條件,導致update delete出現了無法恢復的後果,加上那些庫都是幾十g。恢復起來少說也要十幾分鐘。為此,找了一些資料和工作總結,給出一下幾個方法,用於快速恢復表,而不是庫,但是切記...