私はストアドプロシージャを持っています:-
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 format を含む列です。サブクエリで日付部分のみをシステム日付部分 (06/26/2012 = 06/26/2012) と比較したい
(SELECT MAX(ProductionTimeEntryID)
FROM production
where UserID=@userID
and (CalendarDate = (select GETDATE()))
and IsTaskCompleted=1 )
結果を得るためにどのような変更を行うか教えてください。