🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #765

Re: ���һ������SQL Server������

#765
From: Galaxy��VOLUNTEERS
Date: Mon, 27 Oct 2008 14:12
89 lines
3791 bytes
��ô���ҽ�������һ��case������һģһ����
�Ҿ�ֱ�����ҽ���Ļظ��ˣ�
From my understanding, you would like to receive an event when changes are 
happen to your databases and tell what event happens and where it happens.

If I misunderstand your concern please let me know.

 

Your requirements can be seperated into two parts:

1. capture changes in database

2. send an event to a plugin or application.

I would like to confirm several details with the two parts.

 

1. capture changes in database

SQL Server supports DML triggers and CLR triggers either after an insert, 
update, or delete operation. 

For more information about DML Triggers, please refer to 
<http://msdn.microsoft.com/en-us/library/ms191524.aspx>.

For more information about CLR Triggers, please refer to 
<http://msdn.microsoft.com/en-us/library/ms131093.aspx>

(Just for reference, if you are using SQL Server 2008, there's also a new 
feature called CDC can capture.)

 

I would like to have a check if there will be lots of table in your 
databases DbA, DbB and DbC, and if there will be frequent change in these 
databases.

 

2. send an event to a plugin or application

I wonder whether you want to use a push method or pull method. Push method 
means when event happens the database will automatically send event. Pull 
method means an application scans change regularly to see if there is any 
change.

 

There are several method that may meet your requirements:

1. use sysmessage

You can use RAISERROR, when change happens a message will be sent. You can 
use an application to capture the certain sysmessage.

2. use xp_cmdshell

you can use xp_cmdshell to call other application

3. If you use CLR Trigger, you can try CLR Integration Prgramming solution

4. use extended stored procedure

use sp_addextendedproc

 

Please let me know what solution you prefer.

If you have any question with the method I provide above, please feel free 
to let me know.

 �� �� liuteng ( ������ϲ�����Լ���) �Ĵ������ᵽ: ��
: �������и�����Ļ��������Ƕ���һ���Ѵ��ڵ�SQL Server��ݿ⣬����Ҫ����������
: �ݿ��ijЩ����������insert��update����Ȼ������Щ���������ͬʱ��ִ��һЩ�Զ���
: �IJ����������������ͨ������ִ�У���Ϊ�����޸����е���ݿ����á�
: �ܲ��ܿ�����һЩ�������̬����SQL Server�����л���ʵ�����Ŀ���أ�


--
I thought what I'd do was, I'd pretend I was one of those deaf-mutes
Or should I?

You know what I��d like to be? I mean if I had my goddam choice, I��d just be
the catcher in the rye and all.

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 58.35.148.198]
Technical Details
Message-ID: <4cbcVM$ayX@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cuhk.edu.hk!news.neu.edu.cn!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 101948,c62c232c8d25cc6c,start
X-Google-Attributes: gid101948,domainid0,public,usenet
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cuhk.edu.hk!news.neu.edu.cn!news.shec6.edu.cn!SJTU
From: Dem.bbs@bbs.sjtu.edu.cn (Galaxy��VOLUNTEERS)
Newsgroups: cn.bbs.comp.database
Subject: Re: ���һ������SQL Server������
Date: 27 Oct 2008 14:12:38 GMT
Organization: ��ˮ˼Դ
Message-ID: <4cbcVM$ayX@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1225116646.A