DELETE FROM dbo.REFERENCIAS_MAYORISTAS

INSERT INTO dbo.REFERENCIAS_MAYORISTAS (ID, Codigo, EsReferencia, EsExcepcion, PorcentajeDescuento, FechaCreacion, Cantidad ) 
VALUES (1, '+++', 0, 0, 35, GETDATE(), 6  )

INSERT INTO dbo.REFERENCIAS_MAYORISTAS (ID,Codigo,EsReferencia,EsExcepcion,PorcentajeDescuento, FechaCreacion, Cantidad )
SELECT 
           ROW_NUMBER() OVER (ORDER BY Referencia+CodigoMarca ASC) + 1
           ,Referencia+CodigoMarca
           ,1
           ,1
		   ,0
           ,GETDATE()
		   ,0
FROM INVENTARIO 
WHERE Referencia+CodigoMarca IN 
('TREG-10TAR','DST22001FYK','DST22003FYK','DST22004-1FYK','DST22234FYK','DSTF2912FYK','449-0537SEX','449-0538SEX','449-0539SEX','449-0540SEX','449-0616SEX','449-0617SEX','449-0618SEX','449-0619SEX','449-0620SEX',
'449-0621SEX','449-0622SEX','494-0043AATD','494-0044AATD','494-0049AATD','494-0050AATD','494-0059AATD','494-0061AATD','494-0065AATD','494-0066AATD','494-04009AIR','494-04010AIR','494-04011AIR','494-04012AIR','494-44009AIR',
'494-44010AIR','494-44011AIR','494-44012AIR','5908-1RTS','5918-1RTS','5929-1RTS','5930-1RTS','915-1RTS','H-902RTS','HW-89UBB','I21-DMY132CSO','I21-DMY133CSO','I21-DMY134CSO','I21-DMY135CSO','I21-DMY136CSO',
'I21-DMY137CSO','I21-DMY138CSO','I21-DMY141CSO','I21-DMY143CSO','I21-DMY144CSO','I21-DMY145CSO','I21-DMY147CSO','I21-DMY148CSO','I21-DMY149CSO','J21-DMY163CSO','JOG01KLN','XW021FAP','2-233-VBVRS','DST22002FYK','DST22004-2FYK',
'DST22005FYK','46103HEMB','31066DMIL','1827CLS','3403CLS','3441CLS','449-0359SEX','449-0360SEX','449-0496SEX','JAM-26001STL','LS15028SNS','LS15029SNS','LS15030SNS','LS15032SNS','LS15033SNS',
'LS15034SNS','LS15036SGL','LS15037SGL','LS15039SGL','DT1204PRP','DT1212PRP','FRA3,90KLN','NV62L08NIR','NV62L09NIR','T111DAI','V-024NFS','38085JCSO','38087J408','DT1168PRP','1510BMS',
'1569AMS','2310SXA','25004HEMB','25019DNIR','25029DNIR','3010SXA','3195CLS','3310SXA','3320SXA','3420CLS','3431CLS','3434CLS','3435CLS','3442CLS','3456CLS',
'3660SXA','4010SXA','4020SXA','449-0361SEX','449-0629L&L','449-0630L&L','449-0631L&L','449-0632L&L','449-0633L&L','449-0659SEX','449-0660SEX','449-0661SEX','449-0662SEX','449-0663SEX','449-0664SEX',
'449-0714RDC','449-0715RDC','449-0726RDC','449-0727RDC','449-0732RDC','494-0079AAIR','494-0082AAIR','494-0090AAIR','494-03009AIR','494-10001AIR','494-10002AIR','494-10003AIR','494-10004AIR','494-10005AIR','494-10006AIR',
'494-10007AIR','494-10008AIR','494-10013AIR','494-10014AIR','494-50001AIR','494-50002AIR','494-50003AIR','494-50004AIR','494-50005AIR','494-50006AIR','494-50007AIR','494-50008AIR','494-50013AIR','494-50014AIR','5013NLV',
'8511NLV','AMP-745TXB','AMP-748TXB','AMP-757TXB','AMP-779TXB','AMP-781TXB','AMP-782TXB','AMP-783TXB','AMP-784TXB','AMP-785TXB','AMP-786TXB','AMP-787TXB','AMP-788TXB','AMP-946TXB','BK01VRS',
'BRIP-664TXB','BRIP-665TXB','BRIP-666TXB','BRIP-668TXB','BRIP-669TXB','BRIP-670TXB','BRIP-671TXB','BRIP-672TXB','CM3325VRS','CM3646VRS','CM3745VRS','CM558VRS','CMP78VRS','CMS48VRS','CMS78VRS',
'CMX3745VRS','FC01VRS','FD01VRS','FLR-4470LLR','FLR-4588LLR','FLR-4589LLR','FRA03VRS','JAM-3001VDA','LEG01VRS','MCC3001ABD','MCT3001ABD','MCT5002ABD','MCV3001ABD','MCV5002ABD','MNSC18VRS',
'OV01VRS','SXCP-001SXA','SXCP-002SXA','SXCP-003SXA','XMCC-002SXA','XMCP-001SXA','YDS-7612XVR','YDS-76120194XVR','001-1981CTR','001-1982CTR','001-1984CTR','001-1985CTR','001-1989CTR','1041NCSO','1092DNIR',
'1094DNIR','1099JNIR','1101JNIR','1102NNIR','1110NCSO','1111NCSO','1112JCSO','1113HCSO','1126DNIR','1134DNIR','1143DNIR','1144DNIR','1147DNIR','1148DNIR','1149DNIR',
'1150DNIR','1151DNIR','1152DNIR','1153HEMB','1155HEMB','1156HEMB','1159DNIR','1160JEMB','1162DNIR','1169DNIR','1173DNIR','1176HEMB','1177HEMB','1181DNIR','1182JNIR',
'23098DMIL','23115HCSO','23155HCSO','23156HCSO','23157DMIL','23166HCSO','23167HCSO','23170HCSO','23171HCSO','23173DMIL','23175DMIL','23180JMIL','23185HCSO','23186HCSO','23194JMIL',
'23196JMIL','23206JMIL','23207NMIL','23209JMIL','23210DMIL','23212JMIL','23213DMIL','23214JMIL','23215JMIL','23217JMIL','23218JMIL','23219DMIL','23225JCSO','23227HCSO','23234HCSO',
'23236NCSO','23237JCSO','23238HCSO','23242HCSO','23244DMIL','23248DMIL','23249DMIL','23250DMIL','23251DMIL','23252DMIL','23253DMIL','23255DMIL','23256DMIL','23258DMIL','23259JCSO',
'23260HCSO','23262JMIL','23263DMIL','23265HCSO','23269HCSO','23280HCSO','23287JMIL','23294DMIL','23296DMIL','23297DMIL','23306JMIL','23307JMIL','23308JMIL','23310NMIL','23312NMIL',
'23315JMIL','23316JMIL','23318DMIL','23322DMIL','23323DMIL','26034NMIL','26040NMIL','26043NCSO','26044NCSO','26045NCSO','26046NMIL','26047NMIL','26048NMIL','26049NCSO','26050NCSO',
'26051NCSO','26053NMIL','26054NMIL','26055NCSO','26056NMIL','26057NCSO','26058NMIL','26061NMIL','26062NMIL','26065NMIL','27061DMIL','27063NMIL','27069DMIL','27070DMIL','27078HEMB',
'27079DNIR','27080DNIR','27086HEMB','28095DMIL','28100JMIL','28101JMIL','28102NMIL','28110HCSO','28119HCSO','28127JCSO','28132HCSO','28135DMIL','28137DNIR','28141NCSO','28142JCSO',
'28145NCSO','28146JCSO','28147HCSO','28177HCSO','28178JCSO','28216DMIL','28217JMIL','28218NMIL','30068NMIL','30070JMIL','30083HCSO','30085HCSO','30087JMIL','30090HCSO','30091DMIL',
'30093JCSO','30094JMIL','30097JCSO','30098JMIL','30099NCSO','30100NMIL','30102DMIL','30104NCSO','30106NMIL','30107NMIL','30109JCSO','30110JMIL','30111NCSO','30112NMIL','30114DMIL',
'30122JNIR','30125JEMB','30130HCSO','30141DMIL','30144HCSO','30148DMIL','30151HCSO','30154DMIL','30155JMIL','30156HCSO','30157HCSO','30158JCSO','30159DMIL','30162HCSO','30163HCSO',
'30169HCSO','30170HCSO','30176N408','30180JMIL','30181NMIL','30182NMIL','30183JCSO','30184NCSO','30185NCSO','30187JMIL','30188NMIL','30189HCSO','30190HCSO','30192NCSO','30193DMIL',
'30194JMIL','30195NMIL','30196HCSO','30197HCSO','30198JCSO','30199NCSO','30201HCSO','30205NMIL','3088HCSO','3099DMIL','31022JMIL','31023JMIL','31024NMIL','31031DMIL','3103DMIL',
'31045DMIL','3104DMIL','31054DMIL','31065HCSO','31067DMIL','3106DMIL','31070JCSO','31075DMIL','31076DMIL','3109DMIL','3110DMIL','3113HCSO','3117DMIL','3120DMIL','3123HCSO',
'3127HCSO','3146HCSO','3151HCSO','3153DMIL','3155HCSO','3158HCSO','3159HCSO','3160HCSO','3161HCSO','3163HCSO','3164HCSO','3165HCSO','32012NMIL','32028NMIL','32029JCSO',
'32030JMIL','32032HCSO','32035HCSO','32041HCSO','32044JMIL','32045NMIL','32059HEMB','32060HEMB','32061HEMB','32062HEMB','32063DNIR','32064DMIL','32065DNIR','32066JEMB','32067JEMB',
'32068JEMB','32069JNIR','32070JNIR','32071JNIR','32072NEMB','32074NNIR','32080HCSO','32082DMIL','32083NCSO','32084NCSO','32085NMIL','32086NMIL','32087JMIL','32088NMIL','32089JCSO',
'32090NCSO','32091JMIL','32092NMIL','32095JMIL','32096NMIL','32098NCSO','3262HCSO','3263HCSO','3270HCSO','33011NMIL','33015HMAS','33019HEMB','34002NMIL','34006NCSO','34007NMIL',
'34008NCSO','34010NCSO','34012NCSO','34013NMIL','34014JCSO','34015JMIL','34020HCSO','34021HCSO','34022DMIL','34023JCSO','34024JMIL','34026NMIL','34027DMIL','34028HCSO','34032HCSO',
'34033JCSO','34034JMIL','34035NCSO','34036NMIL','34037NMIL','34043HCSO','34044HCSO','34045NMIL','34046NCSO','34047JCSO','34048NMIL','34049JMIL','34057N408','34061HCSO','34064NCSO',
'34065DMIL','34066JMIL','34067NMIL','34068DMIL','34072DMIL','36067DMIL','36068DMIL','36069DMIL','36070DMIL','36071JMIL','36073JMIL','36074DMIL','36087JMIL','38001HCSO','38002HCSO',
'38003DMIL','38004JCSO','38005JMIL','38007DMIL','38008DMIL','38009JMIL','38010NMIL','38011DMIL','38014DMIL','38015DMIL','38016DMIL','38017JMIL','38018NMIL','38019JMIL','38020NMIL',
'38021NMIL','38022NMIL','38023NMIL','38025NMIL','38026NMIL','38028HCSO','38029HCSO','38031NCSO','38032HCSO','38034JCSO','38036HCSO','38037HCSO','38038JCSO','38040HCSO','38041HCSO',
'38042HCSO','38045NCSO','38047NCSO','38051HCSO','38058HCSO','38086N408','38089JCSO','38096HCSO','38097HCSO','38098NMIL','38099JMIL','38101NMIL','38102JMIL','38104JMIL','38109DMIL',
'40004HCSO','40005HCSO','40008HCSO','41002HEMB','41003HEMB','41004JEMB','41006JEMB','41011HEMB','41018HEMB','41021DNIR','4143NCSO','4144JCSO','42001HCSO','42004HCSO','42006HCSO',
'4210HCSO','4215DMIL','4216DMIL','4217JCSO','4219JMIL','4224DMIL','4232NMIL','4237NCSO','4238NMIL','4241NCSO','4248NCSO','4249JCSO','4251NCSO','4252JCSO','4253HCSO',
'45001HEMB','45007HEMB','46001HCSO','46002HCSO','46004NCSO','46005NCSO','46006DMIL','46007JMIL','46008NMIL','46009NMIL','46019HCSO','46023DMIL','46047DMIL','46062HCSO','46063HCSO',
'46067DMIL','46071HCSO','46072HCSO','46076DMIL','46077JMIL','46091JMIL','46092NMIL','46093JMIL','46094NMIL','46100NCSO','46102JEMB','46104HEMB','46105DNIR','46108DNIR','47002HEMB',
'47003HEMB','47004HEMB','47006DNIR','7003DMIL','7007HCSO','DN59292DNE','FN01VRS','FN02VRS','GE59288GRD','GE59290GRD','JT3466KOAWA','EM59044EMB','EM59045EMB','NV59048NIR','NV59049NIR',
'2006CLS','C14022CSO','EM59043EMB','EM-59045MUT','EM59164EMB','EM59165EMB','EM59166EMB','LE27123LND','LE27124LND','LS27115SNS','LS27119SNS','NV59167NIR','NV59168NIR','NV59169NIR','9001DNE',
'9002DNE','9003DNE','9004DNE','001-0906LAM','001-0907LAM','001-0908LAM','001-0909LAM','001-0947AMG','001-0948AMG','001-0949AMG','001-0950AMG','001-1196CTR','001-1197CTR','001-1198CTR','001-1199CTR',
'001-1200CTR','001-1340AMG','001-1341AMG','001-1343AMG','001-1344AMG','001-1345AMG','001-1346AMG','001-1347AMG','001-1348AMG','001-1349AMG','001-1389LAM','001-1391LAM','001-1392LAM','001-1393LAM','001-1394LAM',
'001-1399AMG','001-1400AMG','001-1401AMG','001-1402AMG','001-1403AMG','001-1404AMG','001-1405AMG','001-1406AMG','001-1407AMG','001-1408AMG','001-1409CTR','001-1410CTR','001-1411CTR','001-1412CTR','001-1413CTR',
'001-1414CTR','001-1415CTR','001-1416CTR','001-1417CTR','001-1418CTR','002-0357LAM','0039-0001NUF','0039-0002NUF','004-0786NUF','004-0791NUF','004-0792NUF','004-0793NUF','004-0796NUF','004-0799NUF','004-1324NUF',
'004-1331NUF','004-1332NUF','004-1333NUF','004-1334NUF','004-1335NUF','004-1336NUF','004-1337NUF','004-1338NUF','004-1339NUF','004-1340NUF','004-1421NUF','004-1422NUF','004-1423NUF','004-1426NUF','004-1428NUF',
'004-1429NUF','15118JSNS','15119JSNS','15120JSNS','15121JSNS','15122JSNS','15123JSNS','15125HCSO','15137JCSO','15139JCSO','15149DSNS','15163DSNS','15167DSNS','15169DSNS','15179DSNS',
'15190DMIL','15194DSNS','15195DSNS','15196DSNS','15197DSNS','15199NSNS','15201NSNS','15212HCSO','15213J408','15222DSNS','15223DSNS','15226DSNS','15228DSNS','15231DSNS','15237JSNS',
'15238JSNS','15239JSNS','15240JSNS','15244HCSO','15249HCSO','15252JCSO','15254JCSO','15256JCSO','15257DSNS','15288DSNS','15291JSNS','15295DSNS','15305HCSO','15306HCSO','15307HCSO',
'15309DMIL','15311DMIL','15312DMIL','15315HCSO','15317HCSO','15333JSNS','15341JSNS','15347JSNS','18035DMIL','18040DMIL','18041JMIL','18042JMIL','18043JMIL','18046DMIL','18047NMIL',
'18048DMIL','18049DMIL','18051DMIL','18053NMAS','18055DNIR','18056DNIR','19057DSNS','19058DSNS','19065HEMB','19067HEMB','19068HEMB','19069HEMB','19070HEMB','19071HGNP','19075HGNP',
'19076JGNP','19078HCSO','30101HCSO','30200HCSO','30202NMIL','30203N408','30204NMIL','30206NMIL','30207N408','31027DMIL','31041DMIL','31042DMIL','31043DMIL','31049DMIL','31050JMIL',
'31052DMIL','31053JMIL','31059HCSO','31061HCSO','31062HCSO','31063HCSO','32034DMIL','32057JMIL','32058JEMB','32077HCSO','34038DNIR','36030DMIL','36031DMIL','36033DMIL','36034DMIL',
'36035DMIL','36036DMIL','36038DMIL','36039DMIL','36040DMIL','36042JMIL','36043JMIL','36044DMIL','36046DMIL','36052DMIL','36053DMIL','36054DMIL','36057DMIL','36060DMIL','36062DMIL',
'36063DMIL','36064DMIL','36065DMIL','36066DMIL','38027DMIL','39001DSNS','39004HCSO','418-0386L&L','418-0387L&L','418-0389LO&','418-0390L&L','418-0393L&L','418-0394L&L','418-0617BCE','418-0618BCE',
'418-0621BCE','449-0513L&L','5016DMIL','5017DMIL','5018DMIL','5019DMIL','5021DMIL','5029HCSO','534GNK','56HER','59432GNK','6016DNIR','6017DNIR','78571GNK','A2-I20-PY071DFF',
'A2-I20-PY073DFF','B3-E20-LW216DFF','BK-0094L&L','BK-0109ESEX','BK-0110SEX','BK-0111SEX','BK-0111ESEX','C21-LW5892CLTS','C21-LW5893CLTS','D-187GNK','D-188GNK','D-190GNK','D-193GNK','D-194GNK','DW158GNK',
'DW159GNK','E21-LGQ5934WBBLTS','E21-LGQ5935CLTS','EM14058EMB','EM14059EMB','EM14060EMB','EM14076EMB','EM14077EMB','EM14078EMB','HB2288GNK','LE27121LND','LE27122LND','LR0401LRN','LR0410LRN','LR32L140LRN',
'LR32L141LRN','LR80M29LRN','LR80M30LRN','LR80M93LRN','LR80M94LRN','LR80M95LRN','LR80M96LRN','LS27113SNS','LS27114SNS','LS32K07SNS','LS32K08SNS','LS32M11SNS','LS32M20SNS','LS32M29SNS','LS8001SNS',
'LS8002LRN','LS8010SNS','LS8012SNS','LS80M20SNS','LS80M26LRN','LS80M27SNS','NK5252GNK','NSK2108GNK','NST8500GNK','NST8507GNK','NST8819GNK','NST8822GNK','NST8877GNK','NST8879GNK','NV14055NIR',
'NV14056NIR','NV14057NIR','NV14073NIR','NV14074NIR','NV14075NIR','NV2001NIR','NV2008DNE','NV2010DNE','NV2011DNE','NV2012DNE','QC9160GNK','SK2219GNK','SK2259GNK','SK2262GNK','SK2265GNK',
'SK2267GNK','SN5447GNK','SN5795GNK','X1467GNK','XL001-1350LAM','XL001-1351LAM','XL001-1352LAM','XL001-1353LAM','XL001-1354LAM','XL001-1357LAM','DTS9097HEN','DTS9098HEN','DTS9106HEN','DTS9139HEN','DTS9141HEN',
'DTS9145HEN','DTS9146HEN','DTS9153HEN','DTS9155HEN','EM59042EMB','LE16002LND','LS27116SNS','NV59046NIR','NV59047NIR','MA80M78MAS','MA80M79MAS','EM14036EMB','EM14037EMB','EM14038EMB','EM14041EMB',
'EM14042EMB','EM14043EMB','EM14068EMB','LE27105LND','LE27107LND','LE27110LND','LE27111LND','ML14032MIL','ML14033MIL','27057LND','14063NMIL','14064JMIL','15061DSNS','15069JSNS','18017DMIL',
'18026JMIL','18027JMIL','19039DSNS','37011MIL','5335DSTY','C59173CSO','EM14034EMB','EM14035EMB','EM14039EMB','EM14040EMB','ML14030MIL','ML14031MIL','C59174CSO','C59175CSO','X7478GNK',
'X7488GNK','X7490GNK','X7507GNK','X7508GNK','X7509GNK','X7565GNK','X7567GNK','X7568GNK','X7651GNK','X7652GNK','X7653GNK','X7654GNK','X7219GNK','X7360GNK','X7361GNK',
'X7561GNK','X7562GNK','X7634GNK','X7661GNK','QC9892GNK','QC9894GNK','A3565GNK','A4817GNK','A4822GNK','A7296GNK','A7360GNK','A8750GNK','A8853GNK','SP40854GNK','SP45873GNK',
'SP4736GNK','SP4737GNK','SP4739GNK','SP4747GNK','SP4753GNK','SP4775GNK','SP4803GNK','SP4807GNK','SP4809GNK','SP4810GNK','SP4814GNK','SP4818GNK','SP4830GNK','SP4831GNK','SP4836GNK',
'SP4837GNK','SP4841GNK','X3060GNK','X3102GNK','X3106GNK','X3107GNK','X3321GNK','X3372GNK','X3395GNK','X3472GNK','X3479GNK','X3574GNK','X3575GNK','X3580GNK','X3596GNK',
'X3638GNK','X3640GNK','X3649GNK','X3655GNK','X3656GNK','X3699GNK','X3712GNK','X3714GNK','X3723GNK','X3724GNK','X3727GNK','X3730GNK','X3734GNK','X3735GNK','X3891GNK',
'170GNK','1082AEL','5130GNK','5553GNK','6629GNK','8724GNK','8728GNK','8731GNK','24001GNK','1203-110GNK','40S-801GNK','7311GNK','A1994GNK','A3501GNK','A3562GNK',
'A3568GNK','A3591GNK','A6907GNK','A6936GNK','A7273GNK','A7403GNK','A7724GNK','A8665GNK','A8764GNK','A8766GNK','A8770GNK','A8775GNK','A8781GNK','A8782GNK','A8784GNK',
'A8787GNK','A8812GNK','A8813GNK','A8881GNK','A8987GNK','A8988GNK','A8992GNK','A8993GNK','A9005GNK','A9009GNK','A9032GNK','ACF-202HGM','BCT-48269-23NED','BCT-48269-24GNK','BCT-48269-25NED',
'F6563GNK','HB30GNK','K147GNK','QC266GNK','QC267GNK','QC268GNK','QC269GNK','QC322GNK','QC357GNK','QC358GNK','QC372GNK','QC373GNK','QC374GNK','QC391GNK','QC392GNK',
'QC393GNK','QC394GNK','QC395GNK','QC9160GNK','QC9674GNK','QC9677GNK','QC9678GNK','QC9763GNK','QC9954GNK','QC9958GNK','QC9959GNK','QC9960GNK','QC9961GNK','RF064GNK','RF1023GNK',
'SIV51084UDR','SK2102GNK','SK2103GNK','SK2136GNK','SK2154GNK','SK2183GNK','SK2195GNK','SK2205GNK','SK2220GNK','SK2225GNK','SK2266GNK','SK2279GNK','SK2284GNK','SK2286GNK','SN3351SAI',
'SN3356SAI','SN3371SAI','SN3381SAI','SN3382SAI','SN3420GNK','SN3547GNK','SN3618GNK','SN4278GNK','SN4286GNK','SN4392GNK','SN4587GNK')
GROUP BY Referencia, CodigoMarca