sql server 获取当前时间和比当前时间晚一个月。(做的是图书馆里系统,作业)

create table BorrowInfo
(
ReaderId int primary key not null,
BooksId int not null,
BorrowTime datetime default getdate(),
RecedeTime
)
1.BorrowTime那个地方正确不??(获取机器当前时间)
2.recedetime后面应该写什么?(在BorrowTime基础上加两个月吧。)

第1个回答  2012-12-07
可以得到当前的月份再加2再与12取余就行了,对了加上2后要判断是否大于12,大于的话就要将年份+1了。
第2个回答  2012-12-08
比当前时间晚2个月

dateadd(month,2,getdate())

至于你那怎么写,你试试。追问

谢谢~

本回答被提问者和网友采纳
大家正在搜