🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Variable Table Name

#741
From: Bill Todd
Date: Tue, 07 Aug 2007 14:14
20 lines
1342 bytes
Serra wrote:

> is it possible to make table name a variable in a s.proc like below ?

No. The optimizer must know the name of the table at the time the
SELECT statement is parsed and optimized.

> 
> 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 ?

SELECT * FROM ATABLE ORDER BY AFIELD DESC ROWS 25

where AFIELD is the field that defines "last".

-- 
Bill Todd (TeamB)
Technical Details
Message-ID: <46b87e2e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!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: "Bill Todd" <no@no.com>
Subject: Re: Variable Table Name
Newsgroups: borland.public.interbase.sql
References:  <46b81945$1@newsgroups.borland.com>
Organization: The Database Group, Inc.
User-Agent: XanaNews/1.18.1.6
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
NNTP-Posting-Host: 65.118.176.23
Message-ID: <46b87e2e$1@newsgroups.borland.com>
Date: 7 Aug 2007 07:14:06 -0700
X-Trace: newsgroups.borland.com 1186496046 65.118.176.23 (7 Aug 2007 07:14:06 -0700)
Lines: 20
X-Authenticated-User: btodd
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail