cancel
Showing results for 
Search instead for 
Did you mean: 

Error using Top n in select statement

Former Member
0 Kudos

SELECT top 2 Logged_By, Logged_On, Product, Reference, Status, External_Reference, Sample_Register.ID

FROM Sample_Register, t_user_team_members, t_user_team_members me

I get this error

Error Executing 'SELECT top 2 Logged_By, Logged_On, Product, Reference, Status, External_Reference, ...' [-5006]: Missing identifier.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

mhm, 7.6. Would you mind sending the full version number?

On the other hand, when I tried with the current 7.6-version, I succeeded.

Therefore I would like to ask you to do

start database studio and run just before sending the statement to be checked

with the dbmcli

dbmcli u2013d u2026 -u u2026 trace_clear

dbmcli u2013d u2026 -u u2026 trace_on all 2

dbmcli u2013d u2026 -u u2026 db_execute diagnose vtrace stop on error -5006

now reproduce the problem

dbmcli u2013d u2026 -u u2026 trace_off all

dbmcli u2013d u2026 -u u2026 trace_flush

dbmcli u2013d u2026 -u u2026 trace_prot akbxms

behind -d the database name and behind -u the systemdba with password has to be given (user,pw)

and please send that part of the resulting file <database>.prot which starts with your commend and ends with -5006

I would like to see if the statement itself or subsequent parts for fetching the result to client-side are the trouble-maker

Elke

Former Member
0 Kudos

Elke

I tried to recreate the problem today - but the statement works correctly! I'm sorry for wasting your time. I've simply pasted the select from this thread into sql editor and it succeeds, but yesterday, it didn't work. I'm afraid I've done something dumb, but I can't see what.

Again thanks for your attention to this.

Joe

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

which version are you using?

Which sqlmode are you using?

The error-position provided together with the error-number really is next to TOP?

Regards,

Elke

Former Member
0 Kudos

Elke

Thanks for your attentions today.

I'm using 7.6. I've tried sqlmode internal and oracle. I'm using database studio, so ansi sqlmode is not available in the logon dialog.

The error is definitely related to the top 2 clause - without it, the query executes. The word select is underlined in red when the error occurs.