update TABLE1 set days = DAY(GETDATE() - CAST(regtime AS smalldatetime))-1 sql-server2000调试通过! GETDATE(),DAY() 是sql-server时间的函数
DATEDIFF Returns the number of date and time boundaries crossed between two specified dates. Syntax DATEDIFF ( datepart , startdate , enddate ) Arguments datepartIs the parameter that specifies on which part of the date to calculate the difference. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.Datepart Abbreviations Year yy, yyyy quarter qq, q Month mm, m dayofyear dy, y Day dd, d Week wk, ww Hour hh minute mi, n second ss, s millisecond ms
sql-server2000调试通过!
GETDATE(),DAY() 是sql-server时间的函数
Returns the number of date and time boundaries crossed between two specified dates. Syntax
DATEDIFF ( datepart , startdate , enddate ) Arguments
datepartIs the parameter that specifies on which part of the date to calculate the difference. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.Datepart Abbreviations
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms