8 个解决方案
#1
建一个表保存表里的记录数,每次查询完以后更新这个表
create table jl(tbname char (20),rows int )
truncate table jl
insert into jl
SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1)
select a.*,b.*
from jl a,(SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1) ) b
where a.tbname=b.name and a.rows<>b.rows and b.name<>'jl'
create table jl(tbname char (20),rows int )
truncate table jl
insert into jl
SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1)
select a.*,b.*
from jl a,(SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1) ) b
where a.tbname=b.name and a.rows<>b.rows and b.name<>'jl'
#2
我用的是c#,能用c#介绍下吗?谢谢
#4
不好判断。
如果表少的话,给表加个INSERT,UPDATE,DELETE触发器,有触发,则算一次更新
#5
为什么我这个sql没有存储过程?谢谢
#6
如果是表结构是否更新可以判断系统表
select name,modify_date from sys.all_objects where type='U'
select name,modify_date from sys.all_objects where type='U'
#7
你要在c#中判断是否表更新吗
#8
如果是插入删除的话,在C#中可以执行两次Count(*)看看行数是否变化,如果是修改的话,写一个存储过程,使用NonQuery判断受影响的行数是否大于等于1,就可以了
#1
建一个表保存表里的记录数,每次查询完以后更新这个表
create table jl(tbname char (20),rows int )
truncate table jl
insert into jl
SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1)
select a.*,b.*
from jl a,(SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1) ) b
where a.tbname=b.name and a.rows<>b.rows and b.name<>'jl'
create table jl(tbname char (20),rows int )
truncate table jl
insert into jl
SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1)
select a.*,b.*
from jl a,(SELECT TOP 100 Percent
sysobjects.name,
sysindexes.rows
FROM sysindexes with(nolock)
JOIN sysobjects with(nolock)
ON sysindexes.id = sysobjects.id AND sysobjects.xtype = 'u'
WHERE sysindexes.indid in(0, 1) ) b
where a.tbname=b.name and a.rows<>b.rows and b.name<>'jl'
#2
我用的是c#,能用c#介绍下吗?谢谢
#3
#4
不好判断。
如果表少的话,给表加个INSERT,UPDATE,DELETE触发器,有触发,则算一次更新
#5
为什么我这个sql没有存储过程?谢谢
#6
如果是表结构是否更新可以判断系统表
select name,modify_date from sys.all_objects where type='U'
select name,modify_date from sys.all_objects where type='U'
#7
你要在c#中判断是否表更新吗
#8
如果是插入删除的话,在C#中可以执行两次Count(*)看看行数是否变化,如果是修改的话,写一个存储过程,使用NonQuery判断受影响的行数是否大于等于1,就可以了