一个数据库程序在本地登录 数据 和  服务器数据本地数据库:select name from UFDATA_001_2013..sysobjects   where xtype='U' except (select name from UFData_999_2010..sysobjects  where xtype='U') 服务器数据库:
select name from UFDATA_001_2013..sysobjects   where xtype='U' except (select name from UFData_999_2010..sysobjects  where xtype='U') 
执行 此两条语句时 本地数据库能正常查询到  而 服务器数据库报出消息 156,级别 15,状态 1,第 1 行
在关键字 'except' 附近有语法错误。except

解决方案 »

  1.   

    select name from UFDATA_001_2013..sysobjects   where xtype='U' 
    except 
    select name from UFData_999_2010..sysobjects  where xtype='U'
      

  2.   

    另外如果是2000的话不能用except,用Not exists代替
      

  3.   

    你服务器上是SQL SERVER 2000吧?
      

  4.   


    (1)SQL2000:string SQLDUIBI = "select a.name from " + SuJu + "..sysobjects a where a.xtype='U' and a.name not in(select name from " + MuDi + "..sysobjects where xtype='U')";(2)SQL2005:
    select name from UFDATA_001_2013..sysobjects   where xtype='U' except (select name from UFData_999_2010..sysobjects  where xtype='U')