日期:2014-05-17 浏览次数:20679 次
ALTER PROCEDURE [dbo].[Proc_T_Novel_Topic_Add_ReCommand] ( @BooksId int, @UserId int, @DateTime datetime, @OrderType int ) AS declare @ID int BEGIN if (select count(*) from dbo.T_Books_Order where BooksId=@BooksId and CONVERT(VARCHAR(10),[DateTime],120)=CONVERT(VARCHAR(10),@DateTime,120) and [DateTime] is not null)>0 begin select 0 as id end else begin insert into dbo.T_Books_Order (UserId,OrderType,BooksId,[DateTime],Status) values(@UserId,@OrderType,@BooksId,@DateTime,1) select 1 as id end END
------解决方案--------------------
convert(datetime,convert(varchar,[DateTime],112)) =@DateTime
------解决方案--------------------
将日期转字符串可以这样
Select convert(varchar(10), getdate(), 121) --2012-08-07
------解决方案--------------------
if datediff(day,convert(varchar(10),dt1,120),dt2)=0 print '日期一样' else print '日期不一样'