- 论坛徽章:
- 0
|
表结构就不用比了吧?
1> select * into t0 from t
2> go
(7 行受到影响)
1> begin transaction
2> declare @num_a int
3> declare @num_b int
4> declare @num_c int
5> select @num_a=count(*) from t
6> select @num_b=count(*) from t0
7> select @num_c=count(*) from t,t0 where t.a=t0.a and t.b=t0.b -- a.col1=b.col1 and a.col2=b.col2....
8> if (@num_a=@num_b and @num_b=@num_c)
9> print \'table a == table b\'
10> else print \'table a =\\= table b\'
11> commit transaction
12> go
table a == table b
1> insert into t0(b) values(1)
2> go
(1 行受到影响)
1> begin transaction
2> declare @num_a int
3> declare @num_b int
4> declare @num_c int
5> select @num_a=count(*) from t
6> select @num_b=count(*) from t0
7> select @num_c=count(*) from t,t0 where t.a=t0.a and t.b=t0.b
8> if (@num_a=@num_b and @num_b=@num_c)
9> print \'table a == table b\'
10> else print \'table a =\\= table b\'
11> commit transaction
12> go
table a =\\= table b |
|