exec('insert into '+@表+'(cVouchType,cVouchID,dVouchDate,cDeptCode,cCoVouchID,cOperator,cCheckMan,iID,cDwCode,cexch_name,cflag)
select io_flag,Bill_num,Bill_date,isnull(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,case IO_flag when 0 then 48 else 49 end as my,''人民币'',''AP'' from 表2)
select io_flag,Bill_num,Bill_date,isnull(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,case IO_flag when 0 then 48 else 49 end as my,''人民币'',''AP'' from 表2)
exec('insert into '+@表+'(cVouchType,cVouchID,dVouchDate,cDeptCode,cCoVouchID,cOperator,cCheckMan,iID,cDwCode,cexch_name,cflag)
select io_flag,Bill_num,Bill_date,isnull(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,case IO_flag when 0 then 48 else 49 end as my,''人民币'',''AP'' from 表2')
select case io_flag when 0 then 48 else 49 end,Bill_num,Bill_date,nullif(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,IO_flag as my,''人民币'',''AP'' from 表2)
select case io_flag when 0 then 48 else 49 end,
,Bill_num,Bill_date,nullif(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,IO_flag as my,''人民币'',''AP'' from 表2)
exec('insert into '+@表+'(cVouchType,cVouchID,dVouchDate,cDeptCode,cCoVouchID,cOperator,cCheckMan,iID,cDwCode,cexch_name,cflag)
select io_flag+48,Bill_num,Bill_date,nullif(ltrim(rtrim(dept_id)),'''') ,Cor_billnum,bill_empid,Aud_Empid,ordercode ,IO_flag as my,''人民币'',''AP'' from 表2')