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') 

解决方案 »

  1.   

    如何吧视图成批导入另外一个数据库呢?
    --------------
    在企业管理里选中所有视图,生成SQL脚本。。在另一个库执行
      

  2.   

    由于我们公司视图比较复杂,所以不能用生成sql脚本,在运行这样的方法
      

  3.   

    或用DTS导入导出..
    2005用SSiS
      

  4.   


    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这里没有
      

  5.   

    select    *    from           ufdata_006_2007..sysobjects       where       type='v'   
    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' 的对象。
    ??又是为什么
      

  6.   

    用:
    表\视图\外健等名与定义的名存在
    -------
    select * from sysobects where Name='AR_ApVouch'   --查看一下xtype是类型
      

  7.   

    用: 
    表\视图\外健等名与定义的名存在 
    ------- 
    select   *   from   sysobects   where   Name='AR_ApVouch'       --查看一下xtype是类型
    ---------
    是v
      

  8.   

    通常在执行时都加一个判断:
    --视图存在先删再建
    if not  object_id('T','U') is null
    drop view T
    go
    create view T
    as
    select ..
      

  9.   

    roy_88  
    视图已经存在了 
    ------
    那为什么运行下面的语句还能选出来呢
    select       name           from           ufdata_006_2007..sysobjects       where       type='v'   
    and           name       not       in   
    (select       name       from           ufdata_006_2008..sysobjects       where       type='v')