- 论坛徽章:
- 1
|
timestamp如何使用
在创建用于浏览的新表时,在表定义中加入名为 timestamp 的列。不
必指定其数据类型,因为系统将自动为该列分配 timestamp 数据类
型。例如:
create table newtable(col1 int, timestamp,
col3 char(7))
只要插入或更新某行, Adaptive Server 就将为其加盖时间戳,方法
是自动为 timestamp 列分配唯一的 varbinary 值
update publishers
set city = "Springfield"
where pub_id = "0736"
and tsequal(timestamp,0x0001000000002ea
不要将 where 子句中的 tsequal 函数用作搜索参数。使用 tsequal 时,
where 子句的其余部分应只与单个行唯一匹配。应只在 insert 和
update 语句中使用 tsequal 函数。如果将 timestamp 列用作搜索子句,
就应象比较常规 varbinary 列那样比较该列,即 timestamp1 =
timepstamp2。 |
|