delete from ORI_DATA.[dbo].[dept_ksly_ori] where tmdate= SUBSTRING(@begin_date,1,4)+SUBSTRING(@begin_date,6,2)
set @sql='
insert into ORI_DATA.[dbo].[dept_ksly_ori](
tmdate,[toLocCode] ,[toLocDesc] ,[fromLocDesc] ,[RpAmt]
,[incidesc] ,[StkGrpDesc] ,[SpAmt]
)
select '+SUBSTRING(@begin_date,1,4)+SUBSTRING(@begin_date,6,2)+',[toLocCode] ,[toLocDesc] ,[fromLocDesc] ,[RpAmt]
,[incidesc] ,[StkGrpDesc] ,[SpAmt]
from ORI_DATA.[dbo].[dept_kslyjlb] where convert(varchar(20),tmdate,120) between '+@begin_date+' and '+@end_date+' '
大家这个是什么问题啊,我源表和目标表的字段一模一样,并且全都是varchar,为什么会报这种问题呀,一直没搞懂
把@sql 打印出来 在工具里执行看看