测试语句:
SQL_Connect1:
CREATE TABLE [dbo].[UpdateLog](
[id] [int] IDENTITY(1,1) NOT NULL,
[ServerID] [int] NOT NULL,
[LandID] [int] NOT NULL,
[InfoType] [varchar](50) NOT NULL,
[udt] [datetime] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[UpdateLog] ADD CONSTRAINT [DF_UpdateLog_udt] DEFAULT (getdate()) FOR [udt]
GO
begin tran
insert UpdateLog(serverid,landid,infotype) values(4,4,'test')
SQL_Connect2:
begin tran
insert UpdateLog(serverid,landid,infotype)values(5,5,'test')
commit tran
SQL_Connect1:
commit tran
select * from dbo.UpdateLog where infotype='test' order by udt desc
556 5 5 test 2009-09-09 14:07:54.100
555 4 4 test 2009-09-09 14:07:49.927
结论: 记录到数据库中的cdt/udt,取的是执行insert这个T-SQL时候的getdate(),而非commit tran时候的getdate()