sql server存储过程有错误,打印出来的语句在查询窗口中没有问题,但就是报错,怎么回事呢?
我在存储过程中是这样写的:打印出来的@sql语句是这样的:deletefromcw.dbo.CBMselect;insertintocw.dbo.CBMselect(BM...
我在存储过程中是这样写的:
打印出来的@sql语句是这样的:
delete from cw.dbo.CBMselect;
insert into cw.dbo.CBMselect(BMH,BMM)
select distinct a.BMH,a.BMM
FROM cwbackup.dbo.cbm2010 a where a.TZ=45 and a.BMH like '8%'
union
select distinct b.BMH,b.BMM
FROM cwbackup.dbo.cbm2011 b where b.TZ=45 and b.BMH like '8%'
union
select distinct c.BMH,c.BMM
FROM cwbackup.dbo.cbm2012 c where c.TZ=45 and c.BMH like '8%'
order by a.BMH;
GO
但是会有下面的报错信息: 展开
打印出来的@sql语句是这样的:
delete from cw.dbo.CBMselect;
insert into cw.dbo.CBMselect(BMH,BMM)
select distinct a.BMH,a.BMM
FROM cwbackup.dbo.cbm2010 a where a.TZ=45 and a.BMH like '8%'
union
select distinct b.BMH,b.BMM
FROM cwbackup.dbo.cbm2011 b where b.TZ=45 and b.BMH like '8%'
union
select distinct c.BMH,c.BMM
FROM cwbackup.dbo.cbm2012 c where c.TZ=45 and c.BMH like '8%'
order by a.BMH;
GO
但是会有下面的报错信息: 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询