Pajder
Pajder

Reputation: 3

trying to run .sql file through powershell

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

Upvotes: 0

Views: 174

Answers (1)

IMSoP
IMSoP

Reputation: 97688

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

Upvotes: 3

Related Questions