InterBase6中的日期型字段的问题(100分)

  • 主题发起人 主题发起人 蒋劲刚
  • 开始时间 开始时间

蒋劲刚

Unregistered / Unconfirmed
GUEST, unregistred user!
我在自定义了一个UDF为getdate(),返回值为TDatetime,
另外有一date型字段,我在一tiger中是这样写的: mtable.mydate := GetDate();
向表中添加数据时,总是报错
请各位高手帮帮忙,谢谢!
 
mtable.mydate.asdatetime
 
getdate()函数是MS SQL server的,
>>mtable.mydate := GetDate();
好像不要加:吧?
改成 mtable.mydate = today;


 
mtable.mydate := GetDate(); 这句话不对
getdate只能用在SQL语句中
或者改为mtable.mydate := now;
或者用SQL语句: 用insert,在其中加getdate


 

to 三代坦克:
哈哈,笔误!让您见笑了!:)。ib6server中有today这个内置函数吗?
to htw:
我已经试通了,IB6server的tiger中DATE型字段要用字符串赋值我把getdate的结果
设为字符串就通了。
timestamp怎么用呢?是否也可以用同样的方法呢?有人用过吗?
 
New operators for retrieving current time, date, and timestamp
The CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP functional
operators return the date and time values based on the moment of
execution of an SQL statement using the server's clock and time
zone. It is no longer necessary to cast TODAY or NOW as DATE to
obtain the current date, time, or timestamp.

For a single SQL statement, the same value is used for each
evaluation of CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP
within that statement. This means that if multiple rows are
updated, as in the following statement, each data row will
have the same value in the aTime column.


UPDATE aTable SET aTime = CURRENT_TIME;

Similarly, if row buffering occurs in a fetch via the remote
protocol, then the CURRENT_TIME is based on the time of the
OPEN of the cursor from the database engine, and not the time
of delivery to the client.
 
New operator to extract information from datetime datatypes
The EXTRACT() function extracts date and time information from databases.

EXTRACT() has the following syntax:


EXTRACT ( part FROM value)

The value passed to the EXTRACT() expression must be DATE, TIME,
or TIMESTAMP. Extracting a part that doesn't exist in a datatype
results in an error. For example:

EXTRACT (TIME FROM aTime)

A statement such as EXTRACT (YEAR from aTime) would fail.
 
IB 6中用Current_Date就可以了,不需要写UDF的
 
谢谢各位!特别感谢三代坦克!
另外,请问我在哪儿可以查到在ib6中的所有内置函数呢?
 
到www.interbase.com下载ib_b60_doc 10Mb的内容应有尽有!
 
to 三代坦克:
你好!你在哪儿查到的这些资料?能告诉我吗?谢谢!
 
http://www.ibphoenix.com/ 有很多资料和技巧.
另外正如madm所说, pdf的IB6文档是最全的了.
 
多人接受答案了。
 
后退
顶部