Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Select TOP ?
Fri, Aug 3 2012 10:47 AMPermanent Link

Rafael

Hi, i'm using the following to select all rows from a column:

test_sql = "select * from table"
set test = objconexao.execute(test_sql)

It works OK.

Now, when trying to limit it to a specific number of rows, a problem happens:

test_sql = "select TOP 5 * from table"
set test = objconexao.execute(test_sql)

Error message:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E09)
[Elevate Software][DBISAM] DBISAM Engine Error # 11949 SQL parsing error - Expected FROM but instead found 5 in SELECT SQL statement at line 1, column 12

What am I doing wrong?
Fri, Aug 3 2012 11:31 AMPermanent Link

Robert Kaplan


<Rafael> wrote in message
news:EA7E87C3-551C-422E-A055-3B600203769B@news.elevatesoft.com...
> Hi, i'm using the following to select all rows from a column:
>
> test_sql = "select * from table"
> set test = objconexao.execute(test_sql)
>
> It works OK.
>
> Now, when trying to limit it to a specific number of rows, a problem
> happens:
>
> test_sql = "select TOP 5 * from table"
> set test = objconexao.execute(test_sql)
>
> Error message:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E09)
> [Elevate Software][DBISAM] DBISAM Engine Error # 11949 SQL parsing error -
> Expected FROM but instead found 5 in SELECT SQL statement at line 1,
> column 12
>
> What am I doing wrong?
>

select * from table top 5

Robert

Fri, Aug 3 2012 11:42 AMPermanent Link

Rafael

Thanks Robert! But now it returns this error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Elevate Software][DBISAM] DBISAM Engine Error # 11013 Access denied to table or backup file '12320'

The DB is located in my local computer, actually. Do you know why this is happening? It's strange that this error don't happen when i just select all the rows, not specifying "top".
Fri, Aug 3 2012 11:58 AMPermanent Link

Raul

Team Elevate Team Elevate

it's either folder permissions or more likely antivirus interfering - when you're doing a TOP then you no longer have a live resultset so DBISAM needs to build a temporary table with the results for you (hence the random temp name of 12320) and then it would delete it after. However it either is unable to create the file (folder permissions) or after it's created AV locks it and DBISAM can't open it again

Raul


Rafael wrote:

Thanks Robert! But now it returns this error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Elevate Software][DBISAM] DBISAM Engine Error # 11013 Access denied to table or backup file '12320'

The DB is located in my local computer, actually. Do you know why this is happening? It's strange that this error don't happen when i just select all the rows, not specifying "top".
Fri, Aug 3 2012 12:07 PMPermanent Link

Rafael

Thanks a lot Raul! I'm very glad for that.

I needed to set up permissions for the Windows\Temp folder.

Now it's working!
Image