This can either be a C# or Sql question. I have a SQL table full of data and
I need to do a calculation on data that looks like this
00:00:06
00:00:36
00:00:42
00:01:48
my select statement will look something like this
SELECT *
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
the data I listed above will be call_duration. I'm not the best sql
developer so how do I sum all of the call_duration results? Common sense
says I can't use var/char as a datatype, can I sum a DateTime type? Can I
use a varchar and use a Sum and Convert together?
Is there a way to return the results in a Dataset/Datatable and do all this
stuff in the C# code although resources will be killed? Any advice on this
one would be greatly appreciated.
Thank you for any advice.
Kevin
--
Kevin C. Brown
Developer 5 1285
"KevinB" <Ke*********@DarbyDentalSupply.comwrote in message
news:52**********************************@microsof t.com...
This can either be a C# or Sql question. I have a SQL table full of data
and
I need to do a calculation on data that looks like this
00:00:06
00:00:36
00:00:42
00:01:48
my select statement will look something like this
SELECT *
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
the data I listed above will be call_duration. I'm not the best sql
developer so how do I sum all of the call_duration results? Common sense
says I can't use var/char as a datatype, can I sum a DateTime type? Can I
use a varchar and use a Sum and Convert together?
Is there a way to return the results in a Dataset/Datatable and do all
this
stuff in the C# code although resources will be killed? Any advice on this
one would be greatly appreciated.
Thank you for any advice.
Kevin
--
Kevin C. Brown
Developer
Are those all the columns in the table?? What happens if a call starts on
one day and ends the next??
LS
That query I included returns 1327 results, the call_duration is just one
column. The actual query is in a stored procedure and would look like this.
I need to sum call_duration and call_time but I'm not sure how to get those
totals. Thanks again.
SELECT [id]
,[pattern]
,[call_date]
,[call_time]
,[call_duration]
,[extension]
,[trunk]
,[dialed_number]
,[place_called]
,[cost]
,[caller_name]
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
--
Kevin C. Brown
Developer
"Lloyd Sheen" wrote:
>
"KevinB" <Ke*********@DarbyDentalSupply.comwrote in message
news:52**********************************@microsof t.com...
This can either be a C# or Sql question. I have a SQL table full of data
and
I need to do a calculation on data that looks like this
00:00:06
00:00:36
00:00:42
00:01:48
my select statement will look something like this
SELECT *
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
the data I listed above will be call_duration. I'm not the best sql
developer so how do I sum all of the call_duration results? Common sense
says I can't use var/char as a datatype, can I sum a DateTime type? Can I
use a varchar and use a Sum and Convert together?
Is there a way to return the results in a Dataset/Datatable and do all
this
stuff in the C# code although resources will be killed? Any advice on this
one would be greatly appreciated.
Thank you for any advice.
Kevin
--
Kevin C. Brown
Developer
Are those all the columns in the table?? What happens if a call starts on
one day and ends the next??
LS
First, create a small sample that demo's what you want.
Here is a sample to get you started.
set nocount on
declare @holder table ( Column1 datetime )
insert into @holder (Column1) values ('00:00:06')
insert into @holder (Column1) values ('00:00:36')
insert into @holder (Column1) values ('00:00:42')
insert into @holder (Column1) values ('00:01:48')
select sum(Column1) as MySum from @holder
select avg(Column1) as MySum from @holder
then post you're expecting results.
DDL (data defintion language) is usually needed in these cases.
"KevinB" <Ke*********@DarbyDentalSupply.comwrote in message
news:52**********************************@microsof t.com...
This can either be a C# or Sql question. I have a SQL table full of data
and
I need to do a calculation on data that looks like this
00:00:06
00:00:36
00:00:42
00:01:48
my select statement will look something like this
SELECT *
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
the data I listed above will be call_duration. I'm not the best sql
developer so how do I sum all of the call_duration results? Common sense
says I can't use var/char as a datatype, can I sum a DateTime type? Can I
use a varchar and use a Sum and Convert together?
Is there a way to return the results in a Dataset/Datatable and do all
this
stuff in the C# code although resources will be killed? Any advice on this
one would be greatly appreciated.
Thank you for any advice.
Kevin
--
Kevin C. Brown
Developer
summing duration is simple, not sure what a sum of call_time would be,
did you want the count?
select sum(datediff(ss,'00:00:00',call_duration) as totduration_secs
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
-- bruce (sqlwork.com)
select
KevinB wrote:
That query I included returns 1327 results, the call_duration is just one
column. The actual query is in a stored procedure and would look like this.
I need to sum call_duration and call_time but I'm not sure how to get those
totals. Thanks again.
SELECT [id]
,[pattern]
,[call_date]
,[call_time]
,[call_duration]
,[extension]
,[trunk]
,[dialed_number]
,[place_called]
,[cost]
,[caller_name]
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
Call duration can be added to a DateTime and add the values together. If you
are workign with SQL 2005, you can use C# to create an assembly in SQL
Server.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
*************************************************
| Think outside the box!
|
*************************************************
"KevinB" <Ke*********@DarbyDentalSupply.comwrote in message
news:52**********************************@microsof t.com...
This can either be a C# or Sql question. I have a SQL table full of data
and
I need to do a calculation on data that looks like this
00:00:06
00:00:36
00:00:42
00:01:48
my select statement will look something like this
SELECT *
FROM [Microcall_Analysis].[dbo].[tbl_CallData]
where extension = '6355'
and call_date between '08/20/07' and '09/20/07'
the data I listed above will be call_duration. I'm not the best sql
developer so how do I sum all of the call_duration results? Common sense
says I can't use var/char as a datatype, can I sum a DateTime type? Can I
use a varchar and use a Sum and Convert together?
Is there a way to return the results in a Dataset/Datatable and do all
this
stuff in the C# code although resources will be killed? Any advice on this
one would be greatly appreciated.
Thank you for any advice.
Kevin
--
Kevin C. Brown
Developer
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phil |
last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server:
class HelloWorld:
_reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}"
_reg_desc_ = "Python Test COM Server"...
|
by: Nathan Sokalski |
last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database
capabilities of ASP and IIS. I am probably using some incorrect settings,
but I am not sure what they are. Here is what...
|
by: Grim Reaper |
last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have
never setup a server from the beginning, so I am a little new at creating
server groups.
Alright, I am trying to create...
|
by: Chris Halcrow |
last post by:
Hi
I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP.
I continually get the error 'cannot configure server' just at the end
of the installation. I've tried the following:
...
|
by: Zorba.GR |
last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64
bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite
Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
|
by: Hazzard |
last post by:
I just realized that the code I inherited is using all asp.net server
controls (ie. webform controls) and when I try to update textboxes on the
client side, I lose the new value of the textbox when...
|
by: Mike |
last post by:
Hi,
I am strugling with a simple problem which I can't seem to resolve.
I have an asp.net page which contains a server-control (flytreeview,
which is a kind
of a tree to be exact).
The tree is...
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of...
|
by: Developer |
last post by:
Hello All,
i have recently installed VS2005 and was trying to install SQL sever
2000.
I have Win XP' SP2. But when I tried installing, it only installed
client tools and not the database.
Can...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |