Re: Umm, almost embarrassed to ask this, but....
Posted in 1998
Topics: SQL Development & Query Writing
Better yet:
select distinct today from systables ;
At 07:51 PM 2/8/98 -0800, you wrote:
>Paul Roberts wrote:
>>
>> In article <34DB8723.410D@netcomuk.co.uk>,
>> Neil Truby <ntruby@netcomuk.co.uk> wrote:
>> >What's the best way to retrieve the value of a system variable, say
>> >TODAY? Obviously, I can do:
>> >
>> >SELECT TODAY from table1
>> >where key='aaa'>> >
>> >but I have to know that this will return a single row. How about a
>> >general select statement that doesn't require detailed knowledge of a
>> >table's data?
>>
>> The standard way to do this seems to be:-
>>
>> select today
>> from systables
>> where tabid = 1>>
>> If I were given to making universal assertions I would probably claim
>> that all Informix databases have a table called "systables" and it
>> always has exactly one row whose tabid is 1; so instead I will merely
>> say that this has been the case with all Informix databases that it
>> has been my pleasure to meet.
>
>Then I guess you've not met MODE ANSI databases... :-(
>
>I agree with the general technique (it's what I use), but if the
>code has to work in both MODE ANSI and non-ANSI databases, then you
>need to quote the table owner:
>
>SELECT TODAY
> FROM 'informix'.SysTables
> WHERE TabID = 1;>
>To be horrendously nit-picking, table owners became part of the Informix
>product set somewhere around the 4.00 release, so this would fail on the
>older versions of the product. I trust that no-one reading this has to
>actually be concerned with pre-4 databases (in fact, I'd like to think
>that most people don't have to fuss with pre-5 databases, but that's a
>bit optimistic, to judge from the questions I see).
>
>
>Yours pedantically,
>Jonathan Leffler (jleffler@earthlink.net or jleffler@visa.com)
>
--
*********************************************************************
* *
* Diversified Collection Services, Inc. *
* *
*********************************************************************
* Kathleen Zunino E-mail: Zunino@DCSWins.com *
* Informix Database Administrator Phone : 510-636-0300 x2102 *
* Fax : 510-636-1886 *
*********************************************************************