There is an import.xls file with format data in it:
+------+--------+ | id | num | +------+--------+ | 1 | 0A3478 | | 2 | 0A3479 | | 3 | 0A3480 | | 4 | 0B1267 | | 5 | 0C3498 | +------+--------+ I import into sql by:
SELECT * FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0', 'Data Source=C:\Folder\import.xlsx; Extended Properties=Excel 12.0 Xml')...[sheet$] There is a table where further you need to insert these values:
CREATE TABLE TABLES( ID int NOT NULL, NUM int NOT NULL ) It has data, let's say it:
+------+--------+ | id | num | +------+--------+ | 1 | 0A3478 | | 2 | 0A3479 | | 80 | 9X0298 | | 90 | 9X6941 | | 100 | 0W5963 | +------+--------+ And if you do an xls import first into a table, for example #tmp, and make a query of the form:
SELECT * FROM #tmp WHERE num not in (SELECT num FROM TABLES) That request does not return anything, but should in theory:
+------+--------+ | id | num | +------+--------+ | 3 | 0A3480 | | 4 | 0B1267 | | 5 | 0C3498 | +------+--------+ I did the unloading of xls hundreds of times, and then everything is simple to the banal, but something doesn’t work, and let's say “zamylilas”, you need a fresh look, tell me who’s wrong here))
TABLES.numto eliminate such a misunderstanding. - Mike