Subject | RE: [ib-support] Limiting Record Count |
---|---|
Author | Amrita Chaudhury |
Post date | 2002-04-12T15:11:18Z |
We cant use set generator inside stored procs, can we ??
-----Original Message-----
From: ibrahim Bulut [mailto:ibrahim@...]
Sent: Friday, April 12, 2002 8:06 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] Limiting Record Count
Hi all,
I have got a new idea.
I want to share my idea with mail group.
Sometimes,
A lot of records fetch from query.
But we want first 10 record.
I didn't do it.
I asked this problem to mail group, my friends.
But I couldn't do it.
Some of myfriends (They are using Ms Sql Server) told me try following sql
statement
SELECT TOP 5 * FROM TABLE
This sql statement fetchs only first 5 record from table1.
But I couldn't do it with interbase.
We can do it with this way in interbase.
Create a TEMP generator.
Before Execute sql statement set generator's value to 0
SET GENERATOR TEMP TO 0;
And add this statement to where clause
(GEN_ID(TEMP,1) < 100)
Example
I want first 100 records from my table
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (GEN_ID(TEMP,1) <= 100)
another example
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (FIELD1 BETWEEN '01.01.2001' AND '31.12.2001') AND
(FIELD2 STARTING '100')
if I execute this statement 1500 records will fetch, but I want first 100
record.
I can do it with this statement
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (FIELD1 BETWEEN '01.01.2001' AND '31.12.2001') AND
(FIELD2 STARTING '100') and (GEN_ID(TEMP,1) <= 100)
Ibrahim Bulut
Software Developer
Republic of Turkey
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://rd.yahoo.com/M=217097.2003762.3481930.1261774/D=egroupweb/S=17051153
86:HM/A=1042587/R=0/*http://service.bfast.com/bfast/click?bfmid=29150849&sit
eid=39282504&bfpage=account>
<http://us.adserver.yahoo.com/l?M=217097.2003762.3481930.1261774/D=egroupmai
l/S=1705115386:HM/A=1042587/rand=943975247>
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
-----Original Message-----
From: ibrahim Bulut [mailto:ibrahim@...]
Sent: Friday, April 12, 2002 8:06 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] Limiting Record Count
Hi all,
I have got a new idea.
I want to share my idea with mail group.
Sometimes,
A lot of records fetch from query.
But we want first 10 record.
I didn't do it.
I asked this problem to mail group, my friends.
But I couldn't do it.
Some of myfriends (They are using Ms Sql Server) told me try following sql
statement
SELECT TOP 5 * FROM TABLE
This sql statement fetchs only first 5 record from table1.
But I couldn't do it with interbase.
We can do it with this way in interbase.
Create a TEMP generator.
Before Execute sql statement set generator's value to 0
SET GENERATOR TEMP TO 0;
And add this statement to where clause
(GEN_ID(TEMP,1) < 100)
Example
I want first 100 records from my table
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (GEN_ID(TEMP,1) <= 100)
another example
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (FIELD1 BETWEEN '01.01.2001' AND '31.12.2001') AND
(FIELD2 STARTING '100')
if I execute this statement 1500 records will fetch, but I want first 100
record.
I can do it with this statement
SET GENERATOR TEMP TO 0;
SELECT * FROM TABLE1
WHERE (FIELD1 BETWEEN '01.01.2001' AND '31.12.2001') AND
(FIELD2 STARTING '100') and (GEN_ID(TEMP,1) <= 100)
Ibrahim Bulut
Software Developer
Republic of Turkey
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://rd.yahoo.com/M=217097.2003762.3481930.1261774/D=egroupweb/S=17051153
86:HM/A=1042587/R=0/*http://service.bfast.com/bfast/click?bfmid=29150849&sit
eid=39282504&bfpage=account>
<http://us.adserver.yahoo.com/l?M=217097.2003762.3481930.1261774/D=egroupmai
l/S=1705115386:HM/A=1042587/rand=943975247>
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]