.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Difference between 2 times 6:00 Hours - 5:50 hours is 10 minutes i.e 0.10 How to do the same in SSRS

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server

Hi I have a report where I have to get the employees absence hours, i.e if there are 8 hours in a day and the employee worked for 5:50 minutes then the difference would be calculated in time.... Please also let em know how to calculate absence hours if the working ours are null as its not showing any value for absence column

WorkingHrs    HoursWorked Absencehours

8                       5.10              2.50

8                        Null              Null

I have query that I have written to get the absenceHours= WorkingHrs - HoursWorked

Please help I feel its a simple query but kinda confused with it. Thanks.


View Complete Post

More Related Resource Links

Get Difference between two dates as Hours, Minutes



 I am using the below query to get difference beiween two dates in hours and minutes.Minutes part look ok but the hours is incorrect.

 select datediff(minute,LastDate,getdate()) as "Minutes", datediff(hour,LastDate,getdate()) as "Hours"from emp.

 Note: Using SQL Server 2005


Expression for 24 hours time and date in SSRS

Hi Guys, What is the expression for  displaying 24 hours time and date in SSRS? Is this the format: =Format(now, "MM/dd/yyyy HH:mm:ss")?Thanks Shiven:)

filtering by minutes and hours

guys, is there a way where i can filter my data based on the minutes and hours ie i already have the start date and end date.. i need to filter by the time as well. any help?

How to Get Total Minutes From Hours in SQL Server 2005?


Hi All.........!

I have 10:45 Hours and Now I want to get Total Minutes Like 645 Minutes.

How Can I Get in SQL Server 2005?

Please Help Me................!

Thanks in Advanced..............!

The TimeSpan could not be parsed because at least one of the hours, minutes,.....


One of my users is getting the following error:  

The TimeSpan could not be parsed because at least one of the hours, minutes, or seconds components is outside its valid range.

Here is what I have pin pointed it down to:


cmd.CommandText = "InsertExportPairing";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@pn", SqlDbType.VarChar, 50).Value = pairing.Number;
        cmd.Parameters.Add("@pt", SqlDbType.Time, 7).Value = pairing.FlightTime.Insert(2, ":");
        cmd.Parameters.Add("@date", SqlDbType.Date).Value = DateTime.ParseExact(pairing.Date, "MMM dd, yy", CultureInfo.InvariantCulture);
        cmd.Parameters.Add("@uid", SqlDbType.Int).Value = userID;
        SqlParameter outParam = cmd.Parameters.Add("@newId", SqlDbType.Int);
        outParam.Direction = ParameterDirection.Output;


want to display 24 hours time and date with datatype Datetime (Not String) in SSRS


Hi All,

I want to display 24 hours time and date in SSRS & for that I am using Format(now,"MM/dd/yyyy HH:mm:ss") but I am using this expression in Parameter, where I need to define datatype of that parameter as DateTime, not string. For Expression Format(now,"MM/dd/yyyy HH:mm:ss"), If I use DateTime datatype, It is showing error but working with String datatype.

For example:

I have parameter To Date  and value of this parameter should be 10/11/2010 13:09:16 (To Date: 10/11/2010 23:09:16) , not in AP or PM format and datatype of this parameter, want to keep DateTime that I can select value from Calender.

Please suggest me how I can achieve this?. I don't want to do it in stored Procedure side, want to do it in report side.

Thanks Shiven:)

Logic to calculate business hours


Hi All,

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.

I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.


Please help me guys... It will be a great help... 

Incremental Crawls take hours randomly


On occasion the incrmental crawls; which usually take under 1 minute take hours to run.

The crawl logs show a successful crawl message and the nothing til it completes, not a single log entry.

It will eventually finish and the next incrmemental will run just fine.

No errors or anything to speak of.

Index has 800K items


Session Timeout increase to 2 hours.



    for Business needs i am planning to increase the session timeout to 2 hours(120 min) in one application, i am using sql server session state. if i increase to 2 hours of session time out, how it will effect the performance of application and web server.

   Could any one help me on this.






My Sql server 2005 Database in recovery mode for 3 -4 hours every day

Hi , Some of our Sql Server 2005 databases remain in recovery mode after midnight for almost 3 to 4 hours. So when my application access them error "Databse in recovery" and for same database this happens again and again every night. Please suggest why and how this can be solved?

Calculating percentage of sceduled hours

 Hi all,       I want to calcultae how many employees are scheduled less 24 hrs for each week,b/w 24 and 48 and greater than 48         In excel file i have weekly wise total hours scheduled for each employee  and total no of days scheduled in week(example 6 days and 1 off)which i will upload it to database,based on this i want to display reports  in bound controls Result should be like this                    Scheduled Hrs      8/1/2010        8/8/2010       8/15/2010       8/22/2010                  Less than 24 hrs     5%                       5%                  5%                   5%        Between 24 and 48 hrs    5%         

Forum Subscriptions emails are sent with a delay of 2 hours

Hello I have a couple of forum subscriptions like the ASP.NET MVC forum and I have noticed that when someone creates a new thread that it takes up to 2 hours before I receive the email notification. Can this setting be changed somewhere because I cannot find it in "Edit Profile". Thanks 

Looking for .net people in the USA to talk to on Live Messenger during work hours... talk code.. ide

Im not sure this is the right place to ask but ill give it a try. If theres a better place for this someone let me know please anyways. I am a .NET dev and would love to have a couple people int/adv level .net devs I could IM a question regarding .NET things I am working on.. not 'do this for me please!' questions but Id want to ask more general ways to go about doing things and just conversation fun talk about coding ideas .. I am the only dev at work so it is lonely not having anyone I can ask questions to.. so if anyone would like to chat add me on Live messenger (punkouter@hotmail.com)

MOSS 2007 Calculate Due Date including working hours and working days

Hi, I've searched many forums for an answer to my problem but with very limited success. Basically, I've created a Sharepoint list where I would like to track a resolution of incidents versus SLA timings. I have a column with a receiving date, which is a date when the request was submitted and another column with priority code where I have 3 possible values: low (5 working days to close the request), medium (3 days) and high (1 day). What I would like to do is to automatically calculate due date for solving the incident based on the receiving date and the priority code. The thing is that now it is getting more complicated since I need to exclude saturdays and sundays from calculation, as well as national holidays. Then I would like to take into account working hours (from 8am to 4pm), for example if an incident with medium priority was submitted on Friday 5pm, then it would have its due date set to Wednesday 4pm (the request was sent after working hours so we have 3 full working days to complete it) Not sure if it is feasible to achieve using formulas, maybe some other way?

Display the Sum of hours and Month Year using sql Query

Hi,  I have,hours(in varchar),Id in table tbl_x ,i need the sum of hours, monthyear(eg. mar 2010)for the last three months.But with two separate queries i am getting these results.but actually i need in the following format   Month/Year      TotalHours-----------------    ----------------Mar 2010            0400Apr 2010             0450-----------------------------------to get month/Year i am using this querySELECT right(convert(varchar, fromdate, 106), 8) from tbl_x where id='11101' for the sum of hours SELECT SUM(CAST(hours AS INT))AS TOTALHRS FROM tbl_x WHERE id='11101'

Multithreading application to launch SSRS report muliple times

Hello, First of all, I am not a .net programmer but fortunately/unfortunately I have to create a scenario where I have to make multiple calls to SSRS report server. Is there a way to create a multithread web application whose threads will call the reports from the report server? I know how to execute a report from .net web application but I don't know how to do it when I have to launch many instances of the same report simultaneously. I believe that by creating multiple threads, I can make each thread to execute same report on report server. Moreover, I should be able to change the no. of threads (no. of threads should be the parameter) at the start of each execution. Since I am primarily a SQL developer and have no practical experience of implementing threading in .net, can anyone please help me out here? Regards.

SQL Server 2005 (X64) Maintenance Clean Up Task Using Hours Option for File Age

I'm running into an issue with SQL Server 2005 64-bit and the maintenance clean up tasks.  I have it set up to delete any transaction logs or backups older than 12 hours.  It seems that there could be some sort of bug because, according to the log files, SQL is running the clean up for 12 days instead.  I've created a work around for this by using execute transact-sql tasks instead, but was wondering if there's a problem with my version of SQL Server, like an SP or patch that I've overlooked. Here's my version information: Microsoft SQL Server 2005 - 9.00.1399.06 (X64)   Oct 14 2005 00:35:21   Copyright (c) 1988-2005 Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend