sql学习--时间戳
--创建临时表,c1为自增id,changelog为时间戳字段
create table #tests(c1 int identity,c2 int default 0,changelog timestamp)
--使用默认值创建数据
insert #tests default values
insert #tests default values
insert #tests default values
insert #tests default values
select * from #tests
--获取最后一个时间戳
select @@DBTS as 'Last timestamp'
--执行影响行操作,同时时间戳会重置
update #tests set c2=c1
select * from #tests
select @@DBTS as 'last timestamp'
go
作者:大胖儿在努力
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。