Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:00:02+00:00 2026-06-08T00:00:02+00:00

CREATE procedure St_Proc_GetUserReportforCurrentDayTask @userID int as Begin set NoCount on; DECLARE @TODAY DATE SET

  • 0
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 Production.UserID=@userID and CalendarDate >= @TODAY                        
    End 

From the above Stored Procedure i am filling a Dataset.After that i am binding this Dataset to a grid view.
In the dataset ,the Column Duration contains Data in HH:MM Format(example-01:00,12:45,02:59 etc).Is there a way that i can get the total of Duration in HH:MM format from the dataset itself.I dont want to query again from the Database to get the Sum of the Duration.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:00:06+00:00Added an answer on June 8, 2026 at 12:00 am

    If you’re using at least SQL-Server 2008, you should use Time datatype to represent a .NET TimeSpan.

    To get it to work with a varchar-column, i would use Linq-To-DataSet, for example:

    var timeSpans = dataSet.Tables[0].AsEnumerable()
        .Select(r => new {
            DurHour   = r.Field<String>("Duration").Split(':')[0],
            DurMinute = r.Field<String>("Duration").Split(':')[1]
        })
        .Select(x => new TimeSpan(int.Parse(x.DurHour), int.Parse(x.DurMinute), 0));
    
    Console.WriteLine("Total time in minutes: {0}", timeSpans.Sum(ts=>ts.TotalMinutes));
    

    But that is only a workaround, actually you should really avoid to store a timespan in a varchar column, use varchar only for text and nothing else.

    In SQL-Server 2005 (or other dbms) you could also use two columns, one for the start DateTime and one for the end DateTime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure :- CREATE procedure St_Proc_GetTimeEntryID @userID int, @timeEntryID int output
At the moment I write stored procedures this way: create proc doStuff @amount int
i am writing stored procedures in MySQL that return values; CREATE PROCEDURE getCustomerById (id
I'm trying to create a simple stored procedure which I can use to write
I am attempting to create a stored procedure/ADO.NET mapping mechanism where a stored procedure
I want to create a procedure which returns a table on the basis of
i am writing a folloing pgsql procedure : CREATE OR REPLACE FUNCTION KNN(gid_ integer)
Compare the following stored procedures: CREATE PROCEDURE testProc1 AS SELECT * INTO #temp FROM
I have a huge stored procedure and I want to create a progress bar
I'm new to MySql. I created a procedure : DELIMITER $$ CREATE PROCEDURE `sampledb`.`InsertSample`

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.