LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2010, 09:12 AM   #1
miamagoo
Member
 
Registered: Jun 2010
Posts: 32

Rep: Reputation: 15
Question running sql script under sqlite3


Hi, I am a newbie to sqlite3 db. I have been given a sql script with SQL commands in it to set up a new sqlite3 db. How do I run such a thing?
 
Old 06-16-2010, 09:23 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
One way:

1. Start a terminal window

2. Run sqlite3 with your database filename:
Quote:
sqlite3 test.db
<= This will create "test.db" if it doesn't already exist
Substitute your actual DB filename for "test.db"
3. From inside the sqlite3 shell, run your script:
Quote:
.read MYSCRIPT.SQL
<= substitute your actual script name
Two good links:
http://souptonuts.sourceforge.net/re..._tutorial.html
http://www.sqlite.org/sqlite.html

'Hope that helps .. PSM

PS:
The first link also has some good information about using sqlite from C/C++ (and other languages), per your earlier posts...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop or check SQlite3 database continuously, when query found run script for first 3 Techno Guy Linux - Newbie 3 09-27-2009 07:46 PM
MY SQL running at 90% - Web site is bogged down - culprit? muskiediver Linux - Newbie 1 08-03-2006 07:05 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 06:49 AM
Running SQL on linux digital bots Linux - Software 3 06-04-2004 04:44 PM
how do i connect thru SQL Server Running on windows NT puru_09 Linux - Software 1 08-11-2002 10:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration