03-13-2013 01:06 PM
I am trying to access a SQLite database using pipes as follows:
filename QUERY pipe 'sqlite3 home/data/MyDB.db3 "select field1 from table1"';
options linesize = max;
infile QUERY delimiter = '|' missover dsd lrecl = 32767;
I have simplified the query, but the original runs fine from SQLite studio.
However when I run this, I get a single row in my data table with SQL ERROR in it.
If anyone can shed any light on this I'd appreciate it.
04-26-2013 05:01 AM
Sorry - took some time to get back to this. I have tried what you suggested and I have a couple of issues:
1. A simple SQL command runs fine from the prompt (i.e. Select * from MYTABLE) - and the same simple query runs fine from in SAS using pipes.
2. When I try to select from a view (from the prompt or SAS) I get an error that the column name can't be found (i.e. Select * from [myView]) this squery works fine in the IDE
It must be interpreting the query that defines the view correctly as it is looking for the right column.
Is there some issue selecting from views using sqlite3?
One possible issue is that the original .db3 file was created in a windows environment and I have copied it over to a unix environment. I tried dos2unix but that seemed to corrupt the file....
04-26-2013 06:40 AM
Since it seems it's not SAS that is the issue, you might find answers in a different forum. The average SAS user have no experience with SQLite...;-)