请教:MSSQL触发器可以触发应用程序内的事件吗?
MSSQL触发器可以触发应用程序内的事件吗?我想用c#开发时实时得到数据库添加修改等事件信息,不知能不能用数据库的触发器,还是需要用timer自己定时去检查数据库,谢谢大家!
需要这么做吗?
定时器老是去检查也不太好吧,
触发器配合一个log表,自己定义一些status,然后触发之后插入在这个表里
不过外部还是要用timer来检查的
实在不行只能用Timer了,虽然不好,但是大部分都这么用,
不过,不要太频繁哦,否则会加重负担的,
听说SQL Server 2005有个Broke什么的,好象可以完成你说的触发功能
相关问答:
判断表中是否有大于10条以上的数据,
如果存在则按最好录入的时间,删除掉多余的数据。。
保持数据表中只有10条最新的数据。。
谢谢。
select ID,count(1) from TB group by ID having count(1)>10
SQL ......
SQL code:
@uid int
@money float
If not exists(SELECT null from bc_users_table where bet_id=@uid and bet_hk_rationing.exist('/root/items[@straight_bet>'+@money+']') = 1)
--BEGIN
......
表A
SQL code:
autoID outDate type resultDate
1 2010-05-10 11:12:03 1 null
2 2010-05-10 15:10:03 0 n ......
select case null
when '' then '1'
when null then '2' --为什么没有在这个位置判断出来
else '3'
end a
select 1 a,2 b into #a
select isnull(b,0) b from #a where a=2
--b列没 ......
a表uid、fid和b表中的id关联,
如何查询a.uid和a.fid对应b表中的相应字段。
SQL code:
select a.uid,a.fid,b.* from a,b where a.uid=b.id and a.fid=b.id
你是说b.id是由a.uid 和a.fid组成的?
要是的 ......