CREATE procedure St_Proc_GetUserReportforCurrentDayTask
@userID int
as
Begin
set NoCount on;
DECLARE @TODAY DATE
SET @TODAY = CONVERT(VARCHAR(10), GETDATE(), 111)
select CONVERT(VARCHAR,production.CalendarDate,101) + RIGHT (CONVERT(VARCHAR,production.CalendarDate , 100) ,7) as Date,
RegionAndProjectInfo.RegionProjectName as Region ,
County.CountyName as County,
WorkType.WorkTypeName as WorkType,
Task.TaskName as Task,
Production.VolumeProcessed as 'Volumes Processed',
Production.TimeSpent as 'Duration'
from Production
inner join RegionAndProjectInfo
on
RegionAndProjectInfo.RegionProjectID=Production.RegionProjectID
inner join County
on
County.CountyID=Production.CountyID
inner join WorkType
on
WorkType.WorkTypeID=Production.WorkTypeID
inner join Task
on
Task.TaskID=Production.TaskID
where [email protected] and CalendarDate >= @TODAY
End
從上面的存儲過程我正在填充數據集。之後,我將此數據集綁定到網格視圖。 在數據集中,列持續時間包含HH:MM格式的數據(例如01:00,12:45,02:59等)。是否有一種方法可以從HH:MM格式中獲取持續時間總數數據集本身。我不想再次從數據庫中查詢以獲得持續時間的總和。從數據集中獲取HH:MM格式的總數
那麼duration是一個varchar字段? – 2012-07-18 14:17:46
是的。我使用了持續時間作爲varchar,因爲它具有HH:Mm格式的數據。例如01:00,12:45,02:59等 – 2012-07-18 15:04:14
好的,那麼我的答案應該可以幫到你,是嗎? – 2012-07-18 15:30:50