gcue Posted July 12, 2019 Share Posted July 12, 2019 hello world. I am trying to figure out the quotations of this sql command. _SQLite_SQLiteExe($sql_db, _ ".mode tabs" & @CRLF & _ ".import '" & $s_InputFile_Path & "' aTemp" & @CRLF _ , $s_Out, _ $s_SQLITE3EXE_Path) FileDelete($s_InputFile_Path) _SQLite_SQLiteExe($sql_db, "CREATE TABLE aAssetInfo (Owner,PrimaryUser,Asset,Model,Comment,Power_Scheme,Acrobat_Installed,Free_Space,First_Boot,Vault_Installed,Memory_Detected);", $s_Out, $s_SQLITE3EXE_Path, True) _SQLite_SQLiteExe($sql_db, 'INSERT INTO aAssetInfo ("Owner","PrimaryUser","Asset","Model","Comment")' & _ 'SELECT "Owner","PrimaryUser","Asset","Model","Comment" FROM aTemp;', $s_Out, $s_SQLITE3EXE_Path, True) _SQLite_SQLiteExe($sql_db, "DROP TABLE aTemp;", $s_Out, $s_SQLITE3EXE_Path, True) _SQLite_SQLiteExe($sql_db, "Vacuum;", $s_Out, $s_SQLITE3EXE_Path, True) this line is where i am having trouble _SQLite_SQLiteExe($sql_db, 'INSERT INTO aAssetInfo ("Owner","PrimaryUser","Asset","Model","Comment")' & _ it works as is but i am trying to specify a WHERE condition. here is what i have tried _SQLite_SQLiteExe($sql_db, 'INSERT INTO aAssetInfo ("Owner","PrimaryUser","Asset","Model","Comment" WHERE Floor="33")' & _ _SQLite_SQLiteExe($sql_db, "INSERT INTO aAssetInfo ('Owner','PrimaryUser','Asset','Model','Comment' WHERE Floor='33')" & _ but neither work. can a where clause even be specified? thanks in advance! Link to comment Share on other sites More sharing options...
jchd Posted July 12, 2019 Share Posted July 12, 2019 A WHERE clause can't be used in an INSERT statement. Maybe what you're after is something like this: INSERT INTO aAssetInfo ("Owner","PrimaryUser","Asset","Model","Comment") SELECT "Owner","PrimaryUser","Asset","Model","Comment" FROM aTemp where Floor = '33' Also note that in SQLite you can spare the double quotes around schema names (tables, columns, indices, triggers, collations, ...) unless a name is an identifier permitted in that place or contains whitespace(s). This would yield a more readable code: INSERT INTO aAssetInfo (Owner, PrimaryUser, Asset, Model, Comment) SELECT Owner, PrimaryUser, Asset, Model, Comment FROM aTemp where Floor = '33' This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gcue Posted July 12, 2019 Author Share Posted July 12, 2019 brilliant!! thank youuuu!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now