🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #737

Re: Variable Table Name

#737
From: joseph
Date: Tue, 07 Aug 2007 08:29
36 lines
1856 bytes
> is it possible to make table name a variable in a s.proc like below ?
>
> SELECT * FROM : MYTABLE
> WHERE ODATE>=(SELECT MAX(ODATE) FROM : MYTABLE) -15

This would be cool and possible wish list for the future but at the moment i
do not think it can be done.

> if it is not possible how can i select just last 25 records in a table ?

Use an order desc clause and keep a counter.  Suspend only when the counter
is <= 25


joseph



"Serra" <nomail@nomail.com> wrote in message
news:46b81945$1@newsgroups.borland.com...
> IB 6,02
>
> I have 8 tables and i open them with same syntax
> all tables have same date field ( ODATE )
> i dont want to create 8 different s.proc.
> is it possible to make table name a variable in a s.proc like below ?
>
> SELECT * FROM : MYTABLE
> WHERE ODATE>=(SELECT MAX(ODATE) FROM : MYTABLE) -15
>
> if it is not possible how can i select just last 25 records in a table ?
>
> Thank you.
>
>
Technical Details
Message-ID: <46b82d7e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46b81945$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,a41d18d74b656c02
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "joseph" <jpell@di-ve.com>
Newsgroups: borland.public.interbase.sql
References: <46b81945$1@newsgroups.borland.com>
Subject: Re: Variable Table Name
Date: Tue, 7 Aug 2007 10:29:49 +0200
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896
NNTP-Posting-Host: 194.158.51.158
Message-ID: <46b82d7e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1186475390 194.158.51.158 (7 Aug 2007 01:29:50 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail