首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

SQL2000 跨数据库插入语句提示异常

2013-07-01 
SQL2000 跨数据库插入语句提示错误。想把另外一个数据库表的数据插入到当前数据库,两个库的表结构一样的。。

SQL2000 跨数据库插入语句提示错误。
想把另外一个数据库表的数据插入到当前数据库,两个库的表结构一样的。。但是执行的时候提示gl.yeb对象名无效。。帮忙看看神马问题啊。。
use zw0027
insert into gl_yeb('kjnd','kmdm','yeblx','wbdm','gsdm','zth','fzdm0','fzdm1','fzdm2','fzdm3','fzdm4','fzdm5','fzdm6','fzdm7','fzdm8','fzdm9','fzdm10','zdylb','zdydm','ncj','ncd','yj1','yd1','yj2','yd2','yj3','yd3','yj4','yd4','yj5','yd5','yj6','yd6','yj7','yd7','yj8','yd8','yj9','yd9','yj10','yd10','yj11','yd11','yj12','yd12','yj13','yd13','id') select '2013','121501',yeblx,wbdm,'001','001',fzdm0,fzdm1,fzdm3,fzdm2,fzdm4,fzdm5,fzdm6,fzdm7,fzdm8,fzdm9,fzdm10,zdylb,zdydm,ncj,ncd,yj1,yd1,yj2,yd2,yj3,yd3,yj4,yd4,yj5,yd5,yj6,yd6,yj7,yd7,yj8,yd8,yj9,yd9,yj10,yd10,yj11,yd11,yj12,yd12,yj13,yd13,id from zw0014.dbo.gl_yeb a where a.kjnd=2013 and a.zth=0001 and a.kmdm='110' and a.fzdm3  like '1%'


把前面的gl_yeb改成dbp.gl_yeb 或者zw0027.dbo.gl_yeb 都报这个错误提示。

后面那部分 查询数据都正常
[解决办法]

INSERT  INTO gl_yeb  --插入的字段不需要引号
        ( kjnd ,
          kmdm ,
          yeblx ,
          wbdm ,
          gsdm ,
          zth ,
          fzdm0 ,
          fzdm1 ,
          fzdm2 ,
          fzdm3 ,
          fzdm4 ,
          fzdm5 ,
          fzdm6 ,
          fzdm7 ,
          fzdm8 ,
          fzdm9 ,
          fzdm10 ,
          zdylb ,
          zdydm ,
          ncj ,
          ncd ,
          yj1 ,
          yd1 ,
          yj2 ,
          yd2 ,
          yj3 ,
          yd3 ,
          yj4 ,
          yd4 ,
          yj5 ,
          yd5 ,
          yj6 ,


          yd6 ,
          yj7 ,
          yd7 ,
          yj8 ,
          yd8 ,
          yj9 ,
          yd9 ,
          yj10 ,
          yd10 ,
          yj11 ,
          yd11 ,
          yj12 ,
          yd12 ,
          yj13 ,
          yd13 ,
          id
        )
        SELECT  '2013' ,
                '121501' ,
                yeblx ,
                wbdm ,
                '001' ,
                '001' ,
                fzdm0 ,
                fzdm1 ,
                fzdm3 ,
                fzdm2 ,
                fzdm4 ,
                fzdm5 ,
                fzdm6 ,
                fzdm7 ,
                fzdm8 ,
                fzdm9 ,
                fzdm10 ,
                zdylb ,
                zdydm ,
                ncj ,
                ncd ,
                yj1 ,
                yd1 ,
                yj2 ,
                yd2 ,


                yj3 ,
                yd3 ,
                yj4 ,
                yd4 ,
                yj5 ,
                yd5 ,
                yj6 ,
                yd6 ,
                yj7 ,
                yd7 ,
                yj8 ,
                yd8 ,
                yj9 ,
                yd9 ,
                yj10 ,
                yd10 ,
                yj11 ,
                yd11 ,
                yj12 ,
                yd12 ,
                yj13 ,
                yd13 ,
                id
        FROM    zw0014.dbo.gl_yeb a
        WHERE   a.kjnd = 2013
                AND a.zth = 0001
                AND a.kmdm = '110'
                AND a.fzdm3 LIKE '1%'



热点排行