Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tribhuwan.tiwari
Starting Member
1 Post |
Posted - 2012-09-07 : 07:27:24
|
| Hi I need to desin a fucntion which takes three parameterscalculateTime(@threadStatusId,@fromDate,@toDate)I have table Report which contains the folowwing dataThere are 10 types of possible frmStatusId and toStatusId.PrdId RptId ThrdId ChngdDate frmStatusId toStatusId1 101 201 2012-08-01 40 411 101 201 2012-08-03 41 561 101 201 2012-08-04 56 561 101 201 2012-08-06 56 441 101 201 2012-08-08 44 471 102 202 2012-08-20 40 411 102 202 2012-08-22 41 421 102 202 2012-08-23 42 471 102 202 2012-08-25 47 56and so on .........I want to calculate the time in which status of the thread is in 56Moreover I want it for all dates between fromDate and toDate.Suppose fromDate='2012-09-01' and toDate='2012-09-04' then result should be likePrdId RptId ThrdId TimeAssigned Date 1 101 201 ---- 2012-09-011 101 201 ---- 2012-09-021 101 201 ---- 2012-09-031 101 201 ---- 2012-09-04It means that till the considered date time it spent in state 56.I am completely new and this looks very complex for me. Kindly help how to do this in function. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-08 : 17:13:13
|
| sorry your scenario is not clear. the posted output doesnt seem to have much relationship with posted datapost proper data and output and then somebody might be able to help------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|