我有一个存储过程:-
CREATE procedure St_Proc_GetTimeEntryID
@userID int,
@timeEntryID int output
as begin
set nocount on;
SET @timeEntryID=0
DECLARE @TEMP INT
SET @TEMP=0
SELECT @TEMP=ProductionTimeEntryID
FROM production
WHERE ProductionTimeEntryID =
(SELECT MAX(ProductionTimeEntryID)
FROM production
where UserID=@userID
and (CalendarDate = (select GETDATE()))
and IsTaskCompleted=1 )
BEGIN
SET @timeEntryID=@TEMP
END
END
这里 CalendarDate 是包含 Date As 06/26/201212:00PM 格式的列。我想在我的子查询中仅将日期部分与系统日期部分(06/26/2012 = 06/26/2012)进行比较
(SELECT MAX(ProductionTimeEntryID)
FROM production
where UserID=@userID
and (CalendarDate = (select GETDATE()))
and IsTaskCompleted=1 )
请指导我如何修改以获得结果。