Solved

SQL or ColdFusion?: Determine length of time to take a survery

Posted on 2004-09-24
4
214 Views
Last Modified: 2013-12-24
I am putting together a survey. I'm capturing the datetime when the person starts the survey (startDateTime) and the datetime they finish (endDateTime).

I want to be able to calculate the length of time each person took, as well as determine average time to complete.

I'm using the following code:

select Datediff(ss, startDateTime, endDateTime) as secDiff
from Survey

This will give the response in seconds which I can calulate into minutes:seconds.

Does this seem correct or is there another way that's better?

Thanks
0
Comment
Question by:akawoody
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 125 total points
ID: 12147498
no its very good to let SQL do most of the processing, thats how I mostly do my stuff, I mostly use cf only to display..

If you need minutes you could ofcourse immediately convert the difference to minutes, unless you also need seconds?
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 12148947
Yah! Tacobell777 is right.

It is adviceable to let SQL do the job.  Then I would suggest to use stored procedure.

So the process would be like this :

---------------------
On Your Database
---------------------
-- Create a Procedure
CREATE PROCEDURE GetTimeLength
As
Begin
  Select Datediff(ss, startDateTime, endDateTime) as secDiff
  From Survey
End

----------------------
On Your .cfm Page
----------------------
<!--- Call the Procedure using <cfstoredproc> tag --->
<cfstoredproc procedure="GetTimeLength" datasource="DSN">
  <cfprocresult name="GetRecord">
</cfstoredproc>

<!--- Display result of the procedure --->
<cfoutput query="GetRecord">
  #currentrow# - #secDiff#<br>
</cfoutput>

Hope this helps.  Just try.


Goodluck!
eNTRANCE2002 :-)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question