Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Quert + ODBC Error

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
0
0
AT
Hi, I am using Crystal SQL Query Disgner to Combine two working queries into one.

/////Query 1
SELECT
applic.`idnumber`,
applic.`appl_stat`,
applic.`casemangr`,
refer.`idnumber`,
refer.`proj_from`,
refer.`answer`,
refer.proj_from + refer.answer
FROM
`applic` applic LEFT OUTER JOIN `refer` refer ON applic.`idnumber` = refer.`idnumber`
WHERE
(applic.`appl_stat` = 'EN'
and
refer.`idnumber` NOT IN (SELECT refer.`idnumber` FROM `refer` refer WHERE refer.`proj_from` = '018601' AND refer.`answer` = 'T'))
ORDER BY
applic.`idnumber` ASC

//////Query 2
SELECT
applic.`idnumber`,
applic.`appl_stat`,
applic.`casemangr`
FROM
`applic` applic
WHERE
(applic.`appl_stat` = 'SU0' AND applic.`casemangr` <> '000')
ORDER BY
applic.`idnumber` ASC

/////Query 3 (1+2 combined)
SELECT
applic.`idnumber`,
applic.`appl_stat`,
applic.`casemangr`,
refer.`idnumber`,
refer.`proj_from`,
refer.`answer`,
refer.proj_from + refer.answer
FROM
`applic` applic LEFT OUTER JOIN `refer` refer ON applic.`idnumber` = refer.`idnumber`
WHERE
(applic.`appl_stat` = 'EN'
and
refer.`idnumber` NOT IN (SELECT refer.`idnumber` FROM `refer` refer WHERE refer.`proj_from` = '018601' AND refer.`answer` = 'T'))
or
(applic.`appl_stat` = 'SU0' AND applic.`casemangr` <> '000')
ORDER BY
applic.`idnumber` ASC

This is the error I get when I try to run it.

ODBC error: [Microsoft][ODBC Visual FoxPro Driver] Invalid key length.

My 3rd query may be wrong but I doubt it. Does anyone have any idea what so ever what it could be?

Thanks

 
Sounds like there may be a mismatch between the field on the dbase and the value you have supplied in the query, either by domain or length?
 
try the second query:

SELECT
applic.`idnumber`,
applic.`appl_stat`,
applic.`casemangr`,
0,0,0,0you need the same number of arguments in both first and second
FROM ....

also try to use union between queries. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top