if db_id('AV2000_ALYANTE') is null CREATE DATABASE AV2000_ALYANTE
go
USE AV2000_ALYANTE
go
IF EXISTS(SELECT TABLE_NAME FROM AV2000_ALYANTE.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '_cdm_') DROP TABLE dbo._cdm_
go
CREATE TABLE dbo._cdm_ (ID INT IDENTITY(0,1) PRIMARY KEY, EVENTO VARCHAR(4000),DATA_ORA DATETIME)
go
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Inizio elaborazione', '2022-06-01T15:57:52')
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Creazione dump', '2022-06-01T15:57:52')
go
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Esecuzione dump', GetDate())
go
IF EXISTS(SELECT TABLE_NAME FROM AV2000_ALYANTE.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ARUMAG_01') DROP TABLE dbo.ARUMAG_01
CREATE TABLE dbo.ARUMAG_01(ID_aZI varchar(2),[CODREG] int,[CODMAG] smallint,[CODART] varchar(015),[ANNATA] int,[NLOTTO] varchar(030),[IDFAMI] decimal(013,0),[IDPROD] decimal(013,0),[GIAREG] decimal(016,3))
go
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Esecuzione dump: popolamento tabella ARUMAG', GetDate())
INSERT INTO dbo.ARUMAG_01 VALUES
('01',1,1,'077090000000002',0,'14941',151,170,2000 )
,('01',1,1,'077090000000002',0,'19494',151,170,1000 )
,('01',1,1,'1101043101V0000',2021,'',89,3643,9000 )
,('01',1,1,'1101043101V000V',0,'',89,90,493 )
,('01',1,1,'1101061101V0000',2021,'',90,3624,310470 )
,('01',1,1,'1101061101Z000S',0,'',90,52,2295 )
,('01',1,1,'11020021010SQN1',2021,'',632,3651,203815 )
,('01',1,1,'1102002101V0000',2021,'',71,3572,133950 )
,('01',1,1,'11020231010SQN1',2021,'',631,3654,79845 )
,('01',1,1,'1102023101V0000',2021,'',72,3540,225770 )
,('01',1,1,'1103042101V0000',2021,'',84,3644,30125 )
,('01',1,1,'110304500100000',2021,'',453,3649,110640 )
,('01',1,1,'1104042101V0000',2021,'',75,3645,13000 )
,('01',1,1,'11050021010SQN1',2021,'',635,3704,72520 )
,('01',1,1,'1105002101V0000',2021,'',38,3628,66560 )
,('01',1,1,'11060021010SQN1',2021,'',634,3705,168395 )
,('01',1,1,'1106002101V0000',2020,'',69,2823,13619 )
,('01',1,1,'1106002101V0000',2021,'',69,3577,340147 )
,('01',1,1,'1106002101V0000',2021,'',69,3702,116720 )
,('01',1,1,'1106023101V0000',2021,'',70,3405,30410 )
,('01',1,1,'110602900100021',2021,'',564,3619,105410 )
,('01',1,1,'1109041101V0000',2021,'',86,3716,9670 )
,('01',1,1,'111900100100000',2021,'',299,3647,122280 )
,('01',1,1,'11200011010SQN1',2021,'',636,3709,1302188 )
,('01',1,1,'1121001101V0000',2021,'',6,3463,539582 )
,('01',1,1,'11210211010SQN0',2021,'',572,3710,1639675 )
,('01',1,1,'1121021101V0000',2021,'',23,3487,2633467 )
,('01',1,1,'1123021101V0000',2020,'',65,3082,1710 )
,('01',1,1,'1123021101V0000',2021,'',65,3636,107470 )
,('01',1,1,'113004610100021',2021,'',473,3655,35670 )
,('01',1,1,'1150043101V000S',1111,'',99,210,1612 )
,('01',1,1,'1150061001V0000',2020,'',118,2989,630 )
,('01',1,1,'1150061001V0000',2020,'',118,3125,345 )
,('01',1,1,'115104500100021',2019,'',385,2367,30050 )
,('01',1,1,'1152042101V0000',2021,'',92,3678,12020 )
,('01',1,1,'1153042101V0000',2021,'',91,3679,7620 )
,('01',1,1,'1154042101Z0000',2020,'',59,2961,28000 )
,('01',1,1,'1154042101Z0000',2021,'',59,3634,157000 )
,('01',1,1,'1154043001Z0000',0,'',68,104,1986 )
,('01',1,1,'115404510100021',2021,'',347,3652,36500 )
,('01',1,1,'1155002101V0000',2021,'',73,3703,4350 )
,('01',1,1,'115502310100001',2021,'',614,3569,59772 )
,('01',1,1,'11550231010SQN1',2021,'',693,3700,27840 )
,('01',1,1,'115502410100001',2021,'',619,3538,50160 )
,('01',1,1,'11550241010SQN1',2021,'',688,3701,33040 )
,('01',1,1,'140204510B40020',1111,'L69-22',638,3827,148.5 )
,('01',1,1,'140404210B40010',1111,'L69-22',93,135,91.5 )
,('01',1,1,'1420001A0B40010',1111,'L21341',15,132,223.5 )
,('01',1,1,'1420001E0B40010',1111,'L22105',17,133,245.25 )
,('01',1,1,'1420001E0B60010',1111,'L21320',17,133,1.5 )
,('01',1,1,'1420021A0B40010',1111,'L21341',31,134,123.75 )
,('01',1,1,'1420021E0B40001',0,'L21210',303,954,591.75 )
,('01',1,1,'1420021E0B40002',0,'L22095',637,3032,24 )
,('01',1,1,'1430061D0B40010',1111,'L20079',142,49,176.25 )
,('01',1,1,'145104210B40010',1111,'L70-22',94,136,69 )
,('01',1,1,'145404210B40010',0,'L70-22',98,138,77.25 )
,('01',1,1,'BT570451BT40021',0,'L70-22',568,2393,52.5 )
,('01',2,2,'077090000000002',0,'10505E17',151,170,392 )
,('01',2,2,'077090000000002',0,'19668',151,170,608 )
,('01',2,2,'1101043101V000V',0,'',89,289,1637 )
,('01',2,2,'1101061101Z000S',0,'',90,3676,1025 )
,('01',2,2,'1121001101V0000',2021,'',6,3463,377910 )
,('01',2,2,'1150005101V0000',2021,'',96,3728,11960 )
,('01',2,2,'1150043101V000S',1111,'',99,210,836 )
,('01',2,2,'1150061001V000S',1111,'',118,3677,1323 )
,('01',2,2,'140204510B40020',1111,'L69-22',638,3827,398.25 )
,('01',2,2,'140404210B40010',1111,'L69-22',93,135,292.5 )
,('01',2,2,'1420001A0B40010',1111,'L21341',15,132,1153.5 )
,('01',2,2,'1420001E0B40010',1111,'L21210',17,133,45.75 )
,('01',2,2,'1420001E0B40010',1111,'L22105',17,133,208.5 )
,('01',2,2,'1420001E0B60010',1111,'L22133',17,133,450 )
,('01',2,2,'1420021A0B40010',1111,'L21341',31,134,693 )
,('01',2,2,'1420021E0B40001',0,'L19346',303,954,2896.5 )
,('01',2,2,'1420021E0B40001',0,'L21210',303,954,504 )
,('01',2,2,'1420021E0B40002',0,'L22095',637,3032,159.75 )
,('01',2,2,'1430061D0B40010',1111,'L20079',142,49,37.5 )
,('01',2,2,'145104210B40010',1111,'L70-22',94,136,402.75 )
,('01',2,2,'145404210B40010',0,'L70-22',98,138,336.75 )
,('01',2,2,'BT570451BT40021',0,'L70-22',568,2393,142.5 )
,('01',3,3,'077090000000002',0,'27967',151,170,775 )
,('01',3,3,'077090000000003',0,'003490402',642,3067,225 )
,('01',3,3,'1102002101V0000',2021,'',71,3572,273600 )
,('01',3,3,'1106002101V0000',2021,'',69,3577,579600 )
,('01',3,3,'1124022101V0000',2021,'',149,3549,65000 )
,('01',3,3,'1124022101V0000',2021,'',149,3663,236000 )
,('01',3,3,'1220021B0100000',2021,'',24,3890,60320 )
,('01',3,3,'1220021B0100000',2021,'',24,3898,120640 )
,('01',3,3,'1220021B0100000',2021,'',24,3899,120640 )
,('01',3,3,'1221001B0100000',2021,'',7,3884,19381 )
,('01',3,3,'1221001B0100000',2021,'',7,3885,9719 )
,('01',3,3,'1221001B0100000',2021,'',7,3886,8195 )
,('01',3,3,'1221001B0100000',2021,'',7,3889,60320 )
,('01',3,3,'1221022B0100000',2021,'',145,3865,840 )
,('01',3,3,'1221022B0100000',2021,'',145,3869,420 )
,('01',3,3,'1221022B0100000',2021,'',145,3871,120780 )
,('01',3,3,'1221022B0100000',2021,'',145,3872,60350 )
,('01',3,3,'1221022B0100000',2021,'',145,3873,120700 )
,('01',3,3,'1221022B0100000',2021,'',145,3878,120700 )
,('01',3,3,'1221022B0100000',2021,'',145,3879,120700 )
,('01',3,3,'1221022B0100000',2021,'',145,3880,120700 )
go
INSERT INTO dbo.ARUMAG_01 VALUES
('01',3,3,'1221022B0100000',2021,'',145,3900,119980 )
,('01',3,3,'1321022B0100000',2021,'',146,3897,51557.5 )
,('01',3,3,'1321022B0100000',2021,'',146,3901,59990 )
,('01',3,3,'1420001E0B40010',1111,'L22105',17,133,5224.5 )
,('01',3,3,'1420021E0B40001',0,'L22105',303,954,3132 )
,('01',3,3,'1420022EBT4082C',2021,'L22150C',138,3684,10.5 )
,('01',3,3,'1420022EBT4082D',2021,'L22151C',138,3684,54012 )
,('01',3,3,'1420022EBT4082F',2021,'L22139C',138,3684,4.5 )
,('01',3,3,'1420022EBT4082F',2021,'L22140C',138,3684,15 )
,('01',3,3,'1420022EBT4082F',2021,'L22141C',138,3684,6 )
,('01',3,3,'1420022EBT4082F',2021,'L22143C',138,3684,10.5 )
,('01',3,3,'1420022EBT4082F',2021,'L22144C',138,3684,1590 )
,('01',3,23,'1420001C0B40411',2021,'L1348',570,3743,1.5 )
,('01',3,23,'1420001C0B40411',2021,'L2076',570,3743,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L1348',159,3744,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L2035',159,3744,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L2056',159,3744,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L2077',159,3744,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L2104',159,3744,1.5 )
,('01',3,23,'1420001DBT40411',2021,'L2144',159,3744,1.5 )
,('01',3,23,'1420001E0B40010',1111,'L21210',17,133,1.5 )
,('01',3,23,'1420001E0B40010',1111,'L22105',17,133,1.5 )
,('01',3,23,'1420001E0B40331',2020,'L00102570-21183',17,3057,1.5 )
,('01',3,23,'1420001E0B40331',2020,'L00103131-21184',17,3057,1.5 )
,('01',3,23,'1420001E0B40331',2020,'L00104787-21228',17,3057,1.5 )
,('01',3,23,'1420001E0B40332',2020,'L00102571-21186',17,3057,1.5 )
,('01',3,23,'1420001E0B40332',2020,'L00104203-21216',17,3057,1.5 )
,('01',3,23,'1420001E0B40332',2021,'L00111789-22147',17,3746,1.5 )
,('01',3,23,'1420001E0B40333',2020,'L00102572-21186',17,3057,1.5 )
,('01',3,23,'1420001E0B40334',2020,'L00102846-21187',17,3057,1.5 )
,('01',3,23,'1420001E0B40334',2020,'L00104207-21217',17,3057,1.5 )
,('01',3,23,'1420001E0B40334',2020,'L00105282-21251',17,3057,1.5 )
,('01',3,23,'1420001E0B40335',2020,'L00105477-21252',17,3057,1.5 )
,('01',3,23,'1420001E0B40336',2020,'L00102845-21182',17,3057,1.5 )
,('01',3,23,'1420001E0B40336',2020,'L00103130-21183',17,3057,1.5 )
,('01',3,23,'1420001E0B40336',2020,'L00104201-21218',17,3057,1.5 )
,('01',3,23,'1420001E0B40336',2020,'L00104481-21219',17,3057,1.5 )
,('01',3,23,'1420001E0B40336',2021,'L00111788-22148',17,3746,1.5 )
,('01',3,23,'1420001E0B40336',2021,'L00112235-22150',17,3746,1.5 )
,('01',3,23,'1420001E0B40337',2020,'L00104204-21217',17,3057,1.5 )
,('01',3,23,'1420001E0B40338',2020,'L00104205-21217',17,3057,1.5 )
,('01',3,23,'1420001E0B40339',2020,'L00105480-21251',17,3057,1.5 )
,('01',3,23,'1420001E0B4033A',2020,'L00105479-21252',17,3057,1.5 )
,('01',3,23,'1420001E0B4033C',2020,'L00105580-21251',17,3057,1.5 )
,('01',3,23,'1420001E0B4033D',2021,'L00111790-22148',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L1348',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L2035',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L2056',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L2080',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L2104',17,3746,1.5 )
,('01',3,23,'1420001EBT40411',2021,'L2144',17,3746,1.5 )
,('01',3,23,'1420001FBT40411',2021,'L1348',158,3747,1.5 )
,('01',3,23,'1420021E0B40001',0,'L21210',303,954,1.5 )
,('01',3,23,'1420021E0B40001',0,'L22105',303,954,1.5 )
,('01',3,23,'1420021E0B40331',2020,'L00104195-21212',303,3194,1.5 )
,('01',3,23,'1420021E0B40331',2020,'L00104253-21214',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2020,'L00104197-21215',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2020,'L00104383-21216',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2020,'L00105091-21249',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2020,'L00105496-21250',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2020,'L00106075-21280',303,3194,1.5 )
,('01',3,23,'1420021E0B40332',2021,'L00107035-21336',303,3685,1.5 )
,('01',3,23,'1420021E0B40332',2021,'L00107036-21337',303,3685,1.5 )
,('01',3,23,'1420021E0B40332',2021,'L00107037-21337',303,3685,1.5 )
,('01',3,23,'1420021E0B40332',2021,'L00111786-22146',303,3685,1.5 )
,('01',3,23,'1420021E0B40332',2021,'L00112202-22147',303,3685,1.5 )
,('01',3,23,'1420021E0B40335',2021,'L00107041-21340',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2020,'L00103195-21189',303,3194,1.5 )
,('01',3,23,'1420021E0B40336',2020,'L00104200-21218',303,3194,3 )
,('01',3,23,'1420021E0B40336',2020,'L00105090-21246',303,3194,1.5 )
,('01',3,23,'1420021E0B40336',2020,'L00105450-21249',303,3194,1.5 )
,('01',3,23,'1420021E0B40336',2020,'L00106000-21278',303,3194,1.5 )
,('01',3,23,'1420021E0B40336',2020,'L00106106-21279',303,3194,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00107019-21308',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00107020-21323',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00107021-21324',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00107607-21326',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00107608-21306',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00111785-22145',303,3685,1.5 )
,('01',3,23,'1420021E0B40336',2021,'L00112123-22146',303,3685,1.5 )
,('01',3,23,'1420021E0B40338',2020,'L00103196-21189',303,3194,1.5 )
,('01',3,23,'1420021E0B40338',2020,'L00105089-21246',303,3194,1.5 )
,('01',3,23,'1420021E0B40338',2020,'L00106001-21279',303,3194,1.5 )
,('01',3,23,'1420021E0B40338',2021,'L00107022-21326',303,3685,1.5 )
,('01',3,23,'1420021E0B40339',2020,'L00103200-21189',303,3194,1.5 )
,('01',3,23,'1420021E0B40339',2020,'L00105085-21243',303,3194,1.5 )
,('01',3,23,'1420021E0B40339',2020,'L00105318-21244',303,3194,1.5 )
,('01',3,23,'1420021E0B40339',2020,'L00106080-21287',303,3194,1.5 )
,('01',3,23,'1420021E0B4033A',2020,'L00105086-21244',303,3194,1.5 )
,('01',3,23,'1420021E0B4033A',2020,'L00105371-21245',303,3194,1.5 )
,('01',3,23,'1420021E0B4033B',2020,'L00105088-21245',303,3194,1.5 )
,('01',3,23,'1420021E0B4033B',2020,'L00106078-21285',303,3194,1.5 )
,('01',3,23,'1420021E0B4033B',2020,'L00106547-21286',303,3194,1.5 )
,('01',3,23,'1420021E0B4033B',2021,'L00107023-21327',303,3685,1.5 )
,('01',3,23,'1420021E0B4033B',2021,'L00107024-21328',303,3685,1.5 )
,('01',3,23,'1420021E0B4033B',2021,'L00107715-21328',303,3685,1.5 )
,('01',3,23,'1420021E0B4033C',2020,'L00105087-21246',303,3194,1.5 )
,('01',3,23,'1420021E0B4033C',2020,'L00106079-21286',303,3194,1.5 )
,('01',3,23,'1420021E0B4033D',2020,'L00105298-21249',303,3194,1.5 )
,('01',3,23,'1420021E0B4033D',2021,'L00107170-21327',303,3685,1.5 )
go
INSERT INTO dbo.ARUMAG_01 VALUES
('01',3,23,'1420021E0B4033E',2020,'L00106074-21279',303,3194,1.5 )
,('01',3,23,'1420021E0B4033E',2021,'L00107034-21336',303,3685,1.5 )
,('01',3,23,'1420021E0B4033E',2021,'L00111787-22146',303,3685,1.5 )
,('01',3,23,'1420021E0B4033F',2021,'L00107029-21330',303,3685,1.5 )
,('01',3,23,'1420021E0B4033F',2021,'L00107794-21331',303,3685,1.5 )
,('01',3,23,'1420021E0B4033G',2021,'L00107030-21333',303,3685,1.5 )
,('01',3,23,'1420021E0B4033H',2021,'L00107039-21337',303,3685,1.5 )
,('01',3,23,'1420021E0B4033H',2021,'L00107978-21340',303,3685,1.5 )
,('01',3,23,'1420021E0B4033I',2021,'L00107043-21340',303,3685,1.5 )
,('01',3,23,'1420021E0B4033J',2021,'L00107550-21327',303,3685,1.5 )
,('01',3,23,'1420022E0B40331',2021,'L00107025-21328',138,3684,1.5 )
,('01',3,23,'1420022E0B40331',2021,'L00107026-21329',138,3684,1.5 )
,('01',3,23,'1420022E0B40331',2021,'L00107716-21329',138,3684,1.5 )
,('01',3,23,'1420022E0B40332',2020,'L00103199-21188',138,3015,1.5 )
,('01',3,23,'1420022E0B40332',2020,'L00103322-21189',138,3015,1.5 )
,('01',3,23,'1420022E0B40332',2021,'L00107032-21334',138,3684,1.5 )
,('01',3,23,'1420022E0B40332',2021,'L00107033-21335',138,3684,1.5 )
,('01',3,23,'1420022E0B40335',2020,'L00103198-21187',138,3015,1.5 )
,('01',3,23,'1420022E0B40335',2020,'L00103276-21188',138,3015,1.5 )
,('01',3,23,'1420022E0B40335',2021,'L00107031-21333',138,3684,3 )
,('01',3,23,'1420022E0B40335',2021,'L00107829-21334',138,3684,1.5 )
,('01',3,23,'1420022E0B40336',2020,'L00103277-21188',138,3015,1.5 )
,('01',3,23,'1420022E0B40337',2020,'L00104198-21215',138,3015,1.5 )
,('01',3,23,'1420022E0B40338',2020,'L00104199-21216',138,3015,1.5 )
,('01',3,23,'1420022E0B40338',2020,'L00106067-21280',138,3015,1.5 )
,('01',3,23,'1420022E0B40339',2020,'L00106076-21284',138,3015,1.5 )
,('01',3,23,'1420022E0B40339',2020,'L00106077-21285',138,3015,1.5 )
,('01',3,23,'1420022E0B40339',2020,'L00106453-21285',138,3015,1.5 )
,('01',3,23,'1420022E0B4033A',2021,'L00107027-21330',138,3684,1.5 )
,('01',3,23,'1420022E0B4033A',2021,'L00107028-21330',138,3684,1.5 )
,('01',3,23,'1420022E0B4033B',2021,'L00107533-21322',138,3684,1.5 )
,('01',3,24,'1420001D0B40211',1111,'CV0113018921195',159,3223,1.5 )
,('01',3,24,'1420001D0B40211',1111,'CV0113018921196',159,3223,1.5 )
,('01',3,24,'1420001EBT40213',1111,'CV0113048721252',17,181,1.5 )
,('01',3,24,'1420001EBT40213',1111,'CV0113048721253',17,181,1.5 )
,('01',3,24,'1420021EBT40211',2020,'CV0113014521190',303,3218,1.5 )
,('01',3,24,'1420021EBT40211',2020,'CV0113014521191',303,3218,1.5 )
,('01',3,24,'1420022DBT40214',1111,'CV0113018821193',161,436,1.5 )
,('01',3,24,'1420022DBT40214',1111,'CV0113018821194',161,436,1.5 )
,('01',3,24,'1420022EBT40210',1111,'CV0113055721280',138,3594,1.5 )
,('01',3,24,'1420022EBT40210',1111,'CV0113055721281',138,3594,1.5 )
,('01',3,24,'1420022EBT40210',1111,'CV0113055721282',138,3594,1.5 )
,('01',3,24,'1420022EBT40210',1111,'CV0113055721284',138,3594,1.5 )
,('01',4,4,'060000000000002',0,'',547,2179,11516 )
,('01',4,4,'077090000000002',0,'23289',151,170,30 )
,('01',4,4,'077090000000002',0,'23379',151,170,300 )
,('01',4,4,'077090000000002',0,'25043',151,170,280 )
,('01',4,4,'077090000000002',0,'25099',151,170,50 )
,('01',4,4,'077090000000002',0,'27858',151,170,1340 )
,('01',4,4,'1101061101V0000',1111,'',90,171,1543 )
,('01',4,4,'1101061101V0000',1111,'',90,3676,20369 )
,('01',4,4,'110304500100000',2021,'',453,3649,234600 )
,('01',4,4,'110602900100021',2021,'',564,3619,696279 )
,('01',4,4,'1150061001V0000',1111,'',118,3677,47828 )
,('01',4,4,'1151042101V0000',2021,'',154,3806,1896 )
,('01',4,4,'115104500100021',2020,'',385,3008,30000 )
,('01',4,4,'115104500100021',2021,'',385,3723,34680 )
,('01',4,4,'115404510100021',1111,'',347,3696,24032 )
,('01',4,4,'115404510100021',2021,'',347,3652,120885 )
,('01',4,4,'1221022B0100000',2021,'',145,3893,120820 )
,('01',4,4,'1221022B0100000',2021,'',145,3895,60410 )
,('01',4,4,'140204510B40020',1111,'L69-22',638,3827,2040 )
,('01',4,4,'140404210B40010',1111,'L69-22',93,135,1847.25 )
,('01',4,4,'1420001A0B40010',1111,'L21341',15,132,369.75 )
,('01',4,4,'1420001E0B40010',1111,'L21210',17,133,40.5 )
,('01',4,4,'1420001E0B40010',1111,'L22105',17,133,288.75 )
,('01',4,4,'1420001E0B60010',1111,'L21320',17,133,3 )
,('01',4,4,'1420021A0B40010',1111,'L21341',31,134,449.25 )
,('01',4,4,'1420021E0B40001',0,'L19346',303,954,30.75 )
,('01',4,4,'1420021E0B40001',0,'L21210',303,954,646.5 )
,('01',4,4,'1420021E0B40002',0,'L21169',637,3032,31.5 )
,('01',4,4,'1420021E0B40002',0,'L22095',637,3032,66.75 )
,('01',4,4,'1430061D0B40010',1111,'L20079',142,49,702.75 )
,('01',4,4,'145104210B40010',1111,'L70-22',94,136,1605.75 )
,('01',4,4,'145404210B40010',0,'L70-22',98,138,1950.75 )
,('01',4,4,'BT570451BT40021',0,'L69-22',568,2393,1711.5 )
,('01',4,4,'BT570451BT40021',0,'L70-22',568,2393,439.5 )
,('01',42,42,'110106110000022',0,'',90,3676,50 )
,('01',42,42,'110106110100001',0,'',90,3676,485 )
,('01',42,42,'11010611010000S',0,'',90,3676,2222 )
,('01',42,42,'11500611010001S',0,'',118,3677,559 )
,('01',42,42,'115404510100021',1111,'',347,3696,904 )
,('01',42,42,'140204510B40020',1111,'L69-22',638,3827,27.75 )
,('01',42,42,'140404210B40010',1111,'L69-22',93,135,17.25 )
,('01',42,42,'1420001A0B40010',1111,'L19291',15,132,2.25 )
,('01',42,42,'1420001A0B40010',1111,'L21341',15,132,22.5 )
,('01',42,42,'1420001E0B40010',1111,'L16344',17,133,15.75 )
,('01',42,42,'1420001E0B60010',1111,'L18026',17,133,7.5 )
,('01',42,42,'1420001E0B60010',1111,'L18338',17,133,9 )
,('01',42,42,'1420021A0B40010',1111,'L21341',31,134,41.25 )
,('01',42,42,'1420021E0B40001',0,'L19346',303,954,15.75 )
,('01',42,42,'1420021E0B40002',0,'L21169',637,3032,6 )
,('01',42,42,'1430061D0B40010',1111,'L20079',142,49,24 )
,('01',42,42,'145104210B40010',1111,'L70-22',94,136,20.25 )
,('01',42,42,'145404210B40010',0,'L70-22',98,138,40.5 )
,('01',42,42,'BT570451BT40021',0,'L70-22',568,2393,15.75 )
,('01',43,43,'11010611010000S',0,'',90,3676,3505 )
,('01',43,43,'11500611010001S',0,'',118,3677,3002 )
,('01',43,43,'115404510100021',1111,'',347,3696,1115 )
,('01',43,43,'140204510B40020',1111,'L69-22',638,3827,50.25 )
go
INSERT INTO dbo.ARUMAG_01 VALUES
('01',43,43,'140204610B40011',1111,'L351-20',639,3034,2.25 )
,('01',43,43,'140404210B40010',1111,'L69-22',93,135,51 )
,('01',43,43,'1420001A0B40010',1111,'L21341',15,132,53.25 )
,('01',43,43,'1420001E0B40010',1111,'L21210',17,133,42 )
,('01',43,43,'1420001E0B60010',1111,'L21320',17,133,9 )
,('01',43,43,'1420021A0B40010',1111,'L21341',31,134,48 )
,('01',43,43,'1420021E0B40001',0,'L19346',303,954,36.75 )
,('01',43,43,'1420021E0B40002',0,'L21169',637,3032,19.5 )
,('01',43,43,'1430061D0B40010',1111,'L20079',142,49,69.75 )
,('01',43,43,'145104210B40010',1111,'L70-22',94,136,94.5 )
,('01',43,43,'145404210B40010',0,'L70-22',98,138,95.25 )
,('01',43,43,'BT570451BT40021',0,'L70-22',568,2393,69.75 )
go
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Esecuzione dump: creazione br-indici tabella ARUMAG_01', GetDate())
BEGIN TRY
CREATE UNIQUE INDEX KEY01 ON dbo.ARUMAG_01 (ID_aZI,CODREG,CODMAG,CODART,ANNATA,NLOTTO,IDFAMI,IDPROD)
END TRY
BEGIN CATCH
INSERT INTO dbo._cdm_ SELECT ERROR_MESSAGE(), GETDATE()
END CATCH;
go
INSERT INTO dbo._cdm_ (EVENTO, DATA_ORA) VALUES ('Fine elaborazione', GetDate())
go
