Stored Proc syntax
I have been using this statement in SQL Server 7
SELECT TOP 30 PERCENT FROM myTable
Is this available in DB2 or something that would produce similiar results?
[176 byte] By [
Mark] at [2007-11-9 18:51:28]

# 1 Re: Stored Proc syntax
Hi,
You can use
SELECT * FROM myTable FETCH FIRST 5 ROWS ONLY
Selecting an actual percentage is possible using the ROW_NUMBER function,
comparing it to the count of all rows.
--Greg
Mark wrote:
> I have been using this statement in SQL Server 7
>
> SELECT TOP 30 PERCENT FROM myTable
>
> Is this available in DB2 or something that would produce similiar results?
# 2 Re: Stored Proc syntax
Hi Greg,
What DB2 platform has that ROW_NUMBER function. I don't see it in db2/os390.
===joe
Greg Nash <gnash@namoicotton.com.au> wrote:
>Hi,
>
>You can use
> SELECT * FROM myTable FETCH FIRST 5 ROWS ONLY
>
>Selecting an actual percentage is possible using the ROW_NUMBER function,
>comparing it to the count of all rows.
>
>--Greg
>
>Mark wrote:
>
>> I have been using this statement in SQL Server 7
>>
>> SELECT TOP 30 PERCENT FROM myTable
>>
>> Is this available in DB2 or something that would produce similiar results?
>
JOE at 2007-11-12 0:03:58 >

# 3 Re: Stored Proc syntax
Hi Joe,
I'm using Win2k (DB2 Universal Database). AFAIK it's in any DB2 UDB version
7.x. I don't know how that relates to /390, but IBM has been getting the
platforms closer together in terms of DB2 feature sets and timing, and /390 has
previously had many features available earlier than other platforms.
--Greg
JOE wrote:
> Hi Greg,
> What DB2 platform has that ROW_NUMBER function. I don't see it in db2/os390.
>
> ===joe
>
> Greg Nash <gnash@namoicotton.com.au> wrote:
> >Hi,
> >
> >You can use
> > SELECT * FROM myTable FETCH FIRST 5 ROWS ONLY
> >
> >Selecting an actual percentage is possible using the ROW_NUMBER function,
> >comparing it to the count of all rows.
> >
> >--Greg
> >
> >Mark wrote:
> >
> >> I have been using this statement in SQL Server 7
> >>
> >> SELECT TOP 30 PERCENT FROM myTable
> >>
> >> Is this available in DB2 or something that would produce similiar results?
> >