Avatar of Cartillo
Cartillo
Flag for Malaysia asked on

Total duration

Hi Experts,

I would like to request Experts help. How to make sure column at "TotalDuration" will automatically sum up time value from TimeIN and TimeOUT columns. Attached the print screen of the MSsql table for Experts perusal. Hope Experts will help.

   
total.png
Microsoft SQL Server

Avatar of undefined
Last Comment
Cartillo

8/22/2022 - Mon
Rajkumar Gs

Use a trigger on INSERT OR UPDATE, which will update TotalDuration column with the calculated value (sum)
Cartillo

ASKER
Hi RajkumarGS,

How to do this in MSSQL? Please advice
ASKER CERTIFIED SOLUTION
Rajkumar Gs

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Rajkumar Gs

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Patrick Matthews

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Anthony Perkins

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Rajkumar Gs

Yes. Patrick and acperkins are right.

I also suggest - Instead of using trigger, you can fetch calculated TotalDuration data on demand.

@Cartillo: You may please ignore all my comments in this thread.

Raj
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Cartillo

ASKER
Hi,

I've revised my sql table, attached the print screen, hope I've followed as per guide..
total1.png
SOLUTION
Patrick Matthews

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Cartillo

ASKER
Hi,

Thanks for the guide.