Process_inv SQL Begin transaction; DELETE FROM LIN WHERE LIN_DAD='undefined'; INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(8.50, '2710132', 'MELOA GÁLIA', (select art_med from art where art_ref='2710132'), 0, 0, (select art_med * 8.50 from art where art_ref='2710132'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 1, 0, 0.000, '', '2710132', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('1',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(4.00, '2710128', 'MIRTILOS CX 125gr', (select art_med from art where art_ref='2710128'), 0, 0, (select art_med * 4.00 from art where art_ref='2710128'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 2, 0, 0.000, '', '2710128', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('2',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(7.00, '2710043', 'MANGA ESPANHA (OSTEN)', (select art_med from art where art_ref='2710043'), 0, 0, (select art_med * 7.00 from art where art_ref='2710043'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 3, 0, 0.000, '', '2710043', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('3',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(1.60, '2710105', 'MARACUJA', (select art_med from art where art_ref='2710105'), 0, 0, (select art_med * 1.60 from art where art_ref='2710105'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 4, 0, 0.000, '', '2710105', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('4',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(3.90, '2710106', 'MARMELOS', (select art_med from art where art_ref='2710106'), 0, 0, (select art_med * 3.90 from art where art_ref='2710106'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 5, 0, 0.000, '', '2710106', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('5',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(40.50, '2710107', 'MELANCIA', (select art_med from art where art_ref='2710107'), 0, 0, (select art_med * 40.50 from art where art_ref='2710107'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 6, 0, 0.000, '', '2710107', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('6',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(35.20, '2710152', 'MELÃO VERDE', (select art_med from art where art_ref='2710152'), 0, 0, (select art_med * 35.20 from art where art_ref='2710152'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 7, 0, 0.000, '', '2710152', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('7',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(14.91, '2710016', 'TOMATE', (select art_med from art where art_ref='2710016'), 0, 0, (select art_med * 14.91 from art where art_ref='2710016'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 8, 0, 0.000, '', '2710016', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('8',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(6.98, '2710067', 'TOMATE CHERRY', (select art_med from art where art_ref='2710067'), 0, 0, (select art_med * 6.98 from art where art_ref='2710067'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 9, 0, 0.000, '', '2710067', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('9',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(5.49, '2710124', 'TOMATE CORAÇÃO DE BOI', (select art_med from art where art_ref='2710124'), 0, 0, (select art_med * 5.49 from art where art_ref='2710124'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 10, 0, 0.000, '', '2710124', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('10',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(3.01, '2710017', 'TOMATE XUXA', (select art_med from art where art_ref='2710017'), 0, 0, (select art_med * 3.01 from art where art_ref='2710017'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 11, 0, 0.000, '', '2710017', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('11',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(4.90, '2710057', 'UVA BRANCA C/GRAINHA', (select art_med from art where art_ref='2710057'), 0, 0, (select art_med * 4.90 from art where art_ref='2710057'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 12, 0, 0.000, '', '2710057', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('12',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(17.00, '2710141', 'UVA BRANCA S/GRAINHA', (select art_med from art where art_ref='2710141'), 0, 0, (select art_med * 17.00 from art where art_ref='2710141'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 13, 0, 0.000, '', '2710141', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('13',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(10.00, '2710057', 'UVA BRANCA C/GRAINHA', (select art_med from art where art_ref='2710057'), 0, 0, (select art_med * 10.00 from art where art_ref='2710057'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 14, 0, 0.000, '', '2710057', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('14',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(4.10, '2710210', 'UVA PASSA MOSCATEL', (select art_med from art where art_ref='2710210'), 0, 0, (select art_med * 4.10 from art where art_ref='2710210'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 15, 0, 0.000, '', '2710210', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('15',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(2.08, '2710066', 'PIMENTO PADRÃO', (select art_med from art where art_ref='2710066'), 0, 0, (select art_med * 2.08 from art where art_ref='2710066'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 16, 0, 0.000, '', '2710066', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('16',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(0.46, '2710118', 'PIMENTO VERDE', (select art_med from art where art_ref='2710118'), 0, 0, (select art_med * 0.46 from art where art_ref='2710118'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 17, 0, 0.000, '', '2710118', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('17',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(5.64, '2710032', 'PIMENTO VERMELHO', (select art_med from art where art_ref='2710032'), 0, 0, (select art_med * 5.64 from art where art_ref='2710032'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 18, 0, 0.000, '', '2710032', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('18',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(5.05, '2710052', 'ROMÃ', (select art_med from art where art_ref='2710052'), 0, 0, (select art_med * 5.05 from art where art_ref='2710052'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 19, 0, 0.000, '', '2710052', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('19',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(0.65, '2710023', 'SALSA', (select art_med from art where art_ref='2710023'), 0, 0, (select art_med * 0.65 from art where art_ref='2710023'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 20, 0, 0.000, '', '2710023', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('20',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(3.32, '2710065', 'COGUMELOS', (select art_med from art where art_ref='2710065'), 0, 0, (select art_med * 3.32 from art where art_ref='2710065'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 21, 0, 0.000, '', '2710065', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('21',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(4.26, '2710144', 'COGUMELOS PORTO BELO', (select art_med from art where art_ref='2710144'), 0, 0, (select art_med * 4.26 from art where art_ref='2710144'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 22, 0, 0.000, '', '2710144', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('22',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(29.19, '2710022', 'CORGETE', (select art_med from art where art_ref='2710022'), 0, 0, (select art_med * 29.19 from art where art_ref='2710022'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 23, 0, 0.000, '', '2710022', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('23',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(6.72, '2710008', 'COUVE CORAÇÃO', (select art_med from art where art_ref='2710008'), 0, 0, (select art_med * 6.72 from art where art_ref='2710008'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 24, 0, 0.000, '', '2710008', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('24',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); INSERT INTO LIN (LIN_QNT,ART_REF,LIN_DCR,LIN_PRC,LIN_DSC,LIN_DSC2,LIN_TOT,LIN_TDC,LIN_NUM,LIN_DAT,LIN_IVA,LIN_UNI,LIN_ENT,LIN_QN2,LIN_ACM,LIN_MOV,LIN_LOJ,LIN_FUN,LIN_TAL,LIN_IMP,ESTADO,LIN_LIN,LIN_TDS,LIN_CST,LIN_STK,LIN_REQ,LIN_INT,LIN_VAL,LIN_DMO,LIN_CHV,LIN_DAD,LIN_CNV,LIN_OUT,LIN_ENC,LIN_ORI,LIN_LOT,lin_siva,lin_civa,lin_mem,lin_mot,lin_viva,stk_tdc,lin_agr,dtalt) VALUES(9.26, '2710004', 'COUVE FLOR', (select art_med from art where art_ref='2710004'), 0, 0, (select art_med * 9.26 from art where art_ref='2710004'),(select substring('undefined',1,6)), (select str(substring('undefined',7,10))), (select cast(getdate()as date)), 0, 0, 0, 0.000, 'S', '0', 1, 0, '', 0, 9, 25, 0, 0.000, '', '2710004', 0, '1900-01-01', (select cast(getdate()as date)), 'undefined'+str('25',6), 'undefined', 0, '', 0, '', 'S/LOTE', 0, 0, '', '', 0, 'N', 0, getdate()); UPDATE DAD SET DAD_MXL=25, DAD_ULT=getdate(), ESTADO=9 WHERE DAD_CHV='undefined' commit transaction : Error converting data type varchar to float.