Uploading to DB, Used Buildings Sample (SQL-file technology)

This example demonstrates how to use $SQLUPLOAD-command (implemented itself via BCP-utility and SQLCMD-tool).
Simple table with old building addresses and codes is in "used_buildings_data.txt" (UTF-8 with BOM), its data is for uploading.
Upload is performed into [USED_BUILDING_LIST] (persistent target table), but BCP inserts rows into [UPLOAD::USED_BUILDING_LIST],
which is an intermediate table. These names are defined in "@used_buildings_uploading.cmd" (SQL-settings in UTF-8):
"set MainTable=USED_BUILDING_LIST", "set UploadTable=UPLOAD::!MainTable!".

Following two scripts are essential here (in this example): "$pre_upload.sql" and "$post_upload.sql".
They are executed correspondingly before and after BCP-uploading (if BCP succeeds), see the scripts.
So the data are subject to checking by corresponding sections in the post-uploading operation.

"upload_used_buildings.cmd" is command for complex upload: "used_buildings_data.txt" >> [USED_BUILDING_LIST].

*** WARNING! ***
It is important to visually check output of BCP-command (here it's in the middle step of our complex uploading),
because in some unfortunable cases its result code (errorlevel variable after the BCP) may be equal to zero,
but the download (BCP-utility) may have some problems that we rather needed to treat as failure,
doing it by viewing message(s) in BCP output.
That is why it is reasonable to launch "upload_used_buildings.cmd" in standalone console window:
<Shift+Enter> or <Shift + MouseLeft::DoubleClick> on CMD-file in Far Manager,
or simply start the command from Windows Explorer.
Project folder in Windows Explorer may be opened from the Far Manager by
<Shift+Enter> or <Shift + MouseLeft::DoubleClick> on ".."-sign (the upper dir.).

Target table creation/destruction is performed by corresponding scripts in "Create table(s)" subfolder:
"(++) USED_BUILDING_LIST.sql" and "(--) USED_BUILDING_LIST.sql".
Target table content deletion is realized by means of "!used_building_list_deletion.*" files.
Target table content view is performed by corresponding scripts in "Used buildings select" subfolder (see files).

— — —