Can anyone find the problem with this simple code?
Posted: 18 Jul 2016 17:37
It is probably a simple problem with parentheses ")" but I can't figure out exactly where the problem lies:
Output:
Code: Select all
@ECHO OFF
SET "tmpImport1=dataRaw_Shares.txt"
SET "tmpSQLImport1=Insert_Shares.sql"
(
@ECHO DELETE FROM Shares;
@ECHO DROP TABLE IF EXISTS tmpDataInsert;
@ECHO CREATE TEMP TABLE IF NOT EXISTS [tmpDataInsert] (
@ECHO [ShareNm] CHAR,
@ECHO [SharePath] CHAR);
@ECHO .separator "|"
@ECHO .import %tmpImport1% tmpDataInsert
@ECHO SELECT * FROM tmpDataInsert;
@ECHO INSERT INTO Shares(ShareNm, SharePath) SELECT * FROM tmpDataInsert;
@ECHO DROP TABLE IF EXISTS tmpDataInsert;
)>"%tmpSQLImport1%"
TYPE "%tmpSQLImport1%"
Output:
Code: Select all
T:\>test
DELETE FROM Shares;
DROP TABLE IF EXISTS tmpDataInsert;
CREATE TEMP TABLE IF NOT EXISTS [tmpDataInsert] (
[ShareNm] CHAR,
[SharePath] CHAR
.separator "|"
.import dataRaw_Shares.txt tmpDataInsert
SELECT * FROM tmpDataInsert;
INSERT INTO Shares(ShareNm, SharePath) SELECT * FROM tmpDataInsert;
DROP TABLE IF EXISTS tmpDataInsert;
The system cannot find the file specified.
T:\>