If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Sql statement for SPSS syntax editor

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Michigan
Posts: 21
Unhappy Sql statement for SPSS syntax editor

HI does anyone know sql to import certain database fields into spss?

It says that I am missing an operator before the frist field, can anyone help me?

To bring the whole db I was able to do, but when I started to just select a few I really needed, it started to get wierd on me .

Here's what I have:


GET DATA
/TYPE = ODBC
/CONNECT = "DSN=MS Access Database;"
"DBQ=C:\db1.mdb;"
/SQL = "SELECT ZIP Code, Zip+4 Code, Census Tract Number, Census Block Number, From Latitude, From Longitude, To Latitude, To Longitude, Multiple Match Indicator FROM [001]".
CACHE.
EXECUTE.


My output editor says this when I run it:

>Warning. Command name: GET DATA
>SQLExecDirect failed :[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ZIP Code'.


>Error # 105. Command name: EXECUTE
>This command is not valid before a working file has been defined.
>This command not executed.


HELP ME PLZZZ!
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Sep 2003
Posts: 1
GET DATA
/TYPE = ODBC
/CONNECT = "DSN=MS Access Database;"
"DBQ=C:\db1.mdb;"
/SQL = "SELECT ZIP Code, Zip+4 Code, Census Tract Number, Census Block Number, From Latitude, From Longitude, To Latitude, To Longitude, Multiple Match Indicator FROM [001]".
CACHE.
EXECUTE.

You need to put quotes around variables that contain a space, though realistically you shouldn't use variables that contain spaces in the first place.
so your code should read.

GET DATA
/TYPE = ODBC
/CONNECT = "DSN=MS Access Database;"
"DBQ=C:\db1.mdb;"
/SQL = "SELECT 'ZIP Code', 'Zip+4 Code', 'Census Tract Number', 'Census Block Number', 'From Latitude', 'From Longitude', 'To Latitude', 'To Longitude', 'Multiple Match Indicator' FROM '[001]'".
CACHE.
EXECUTE.

Do you really have a table called [001] or is the table called 001 and you are thinking in access terms, you would want to reference it as '001' I beliave.


Sorry this reply is so belated, just ran into your question while searching for spss sql info.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Michigan
Posts: 21
thanx i will try that


thanx so much


-Trini
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On