0

hello I am trying to run .sql file through my ex0.db and also I’m adding the sqlite3 -echo so I can see what statements run and what they produce. But it keeps giving me this error...

command: sqlite3 -echo -init ex7.sql ex0.db

PS C:\Users\sasaz\sqlite_driver\sql_exes> sqlite3 -init -echo ex7.sql ex0.db cannot open: "-echo" Error: in prepare, near "ex0": syntax error ex0.db ^--- error here

but in a book i am learning from this command work perfectly

1 Answer 1

3

You've added the -echo in the wrong place by mistake in the example that's giving an error.

Correct command:

sqlite3 -echo -init ex7.sql ex0.db

Which according to the manual will be read as these arguments:

  • -echo - print commands before execution
  • -init ex7.sql - read/process the file "ex7.sql"
  • ex0.db - the name of an SQLite database

Incorrect command:

sqlite3 -init -echo ex7.sql ex0.db

Which is read as:

  • -init -echo - read/process the file "-echo"
  • ex7.sql - the name of an SQLite database
  • ex0.db - SQL to execute
Sign up to request clarification or add additional context in comments.

1 Comment

PS C:\Users\Pajder\lsthw\sql> sqlite3 -echo -init ex7.sql ex5.db -- Loading resources from ex7.sql So now it runs without error but -echo is not working... but when i am in sqlite and use insert for example it repeats my command like this -- --> sqlite> insert into pet values (4, 'vendulka_2', 'village_dog', 15, 1); insert into pet values (4, 'vendulka_2', 'village_dog', 15, 1); but when running from file it doesn't print anything

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.