ufdata_006_2008数据库的视图少于ufdata_006_2007数据。。这样显示正常啊楼主反过来查:
select name from ufdata_006_2007..sysobjects where type='v'
and name not in
(select name from ufdata_006_2008..sysobjects where type='v')
select name from ufdata_006_2007..sysobjects where type='v'
and name not in
(select name from ufdata_006_2008..sysobjects where type='v')
--------------
在企业管理里选中所有视图,生成SQL脚本。。在另一个库执行
2005用SSiS
1.
select name from ufdata_006_2008..sysobjects where type='v' --1980条记录
select name from ufdata_006_2007..sysobjects where type='v'--2200条记录
select name from ufdata_006_2008..sysobjects where type='v'
and name not in
(select name from ufdata_006_2007..sysobjects where type='v')
--2条记录,为什么呢? ---------------------------
楼主的ufdata_006_2008、ufdata_006_2007这两个库的视图有什么关系吗?为什么要用name not in
select name from ufdata_006_2008..sysobjects where type='v'
and name not in
(select name from ufdata_006_2007..sysobjects where type='v')
这个语句只能说明这两个库中有很多视图重名或者ufdata_006_2008里面又个视图,ufdata_006_2007这里没有
and name not in
(select name from ufdata_006_2008..sysobjects where type='v')
执行结果:
a_cbfx_cpcbcy_jh
AR_ApVouchs。
。
。
use ufdata_006_2008
Create VIEW AR_ApVouch
数据库中已存在名为 'AR_ApVouch' 的对象。
??又是为什么
表\视图\外健等名与定义的名存在
-------
select * from sysobects where Name='AR_ApVouch' --查看一下xtype是类型
表\视图\外健等名与定义的名存在
-------
select * from sysobects where Name='AR_ApVouch' --查看一下xtype是类型
---------
是v
--视图存在先删再建
if not object_id('T','U') is null
drop view T
go
create view T
as
select ..
视图已经存在了
------
那为什么运行下面的语句还能选出来呢
select name from ufdata_006_2007..sysobjects where type='v'
and name not in
(select name from ufdata_006_2008..sysobjects where type='v')