Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Selecting just the current_date - have to specify table - why??
Tue, Jan 29 2008 5:17 PMPermanent Link

Damian Haynes
This has been killing me for days, but worked out how to get a current date from the server in a client/server scenario... you have to specify a table!!

select CURRENT_DATE as [date_now] from [dummy_table] top 1;

Why do I have to specify a "from table_name" ?   ... running version 4.25 of DBISAM.
Tue, Jan 29 2008 7:50 PMPermanent Link

Sean McCall
The SQL standard as far as I know is that the "FROM" clause in a select
statement is not optional. It used to be (and probably still is) common
practice in Oracle databases to create a dummy table (I've always seen
it called "DUMMY") with one row so that SQL can be used to perform
calculations to be returned in a result set.


Damian Haynes wrote:
> This has been killing me for days, but worked out how to get a current date from the server in a client/server scenario... you have to specify a table!!
>
> select CURRENT_DATE as [date_now] from [dummy_table] top 1;
>
> Why do I have to specify a "from table_name" ?   ... running version 4.25 of DBISAM.
>
Tue, Jan 29 2008 9:57 PMPermanent Link

Damian Haynes
Thanks for the response. Not sure about MS SQL but I know in PostGreSQL you just do Select Current_Date so I got used to doing stuff like that.

I found a better solution off the session... session.GetRemoteDateTime.
Wed, Jan 30 2008 2:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Damian,

<< Thanks for the response. Not sure about MS SQL but I know in PostGreSQL
you just do Select Current_Date so I got used to doing stuff like that.

I found a better solution off the session... session.GetRemoteDateTime. >>

I was going to suggest that instead. Smiley A lot of the other database
engines provide SELECT-only (no FROM) versions of certain scalar functions
in order to allow them to work independent of the specific front-end
compiler/IDE being used.  Since DBISAM is primarily geared towards
Delphi/C++Builder, it uses straight-up properties for these types of calls.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image