views:

103

answers:

1

How can I both set rowcount and then execute a query in a Statement.executeQuery() function?

note I don't want to use Statement.setMaxRows() to do this

A: 

Before sybase ASE 12.5.3, you need to use "set rowcount #" and then select the entries. For higher versions you can simply use the following

--Get top 10 rows.
select top 10 * from TAB_A order by my_col asc

Check your Sybase ASE version by giving

select @@version

If your version is not 12.5.4 or above, I suggest upgrading to 12.5.4. (You will just have to install an EBF)

gd047