Viewing 15 posts - 151 through 165 (of 391 total)
Hi Scott.... revisiting your code above.... I'm getting a "Msg 8120, Level 16, State 1, Line 24
Column 'alias1.CALL_TIME_SECS' is invalid in the select list because it is not contained in...
March 30, 2021 at 2:37 pm
How do I integrate your
CROSS APPLY dbo.itvfGetSeconds(Call_Time) ctsec
CROSS APPLY dbo.itvfGetSeconds(Talk_Time) ttsec
code with the needed code below?:
FROM a2wh.dbo.CallLogCommon com with (NOLOCK)
JOIN a2wh.dbo.Campaigns ud with (NOLOCK)
ON com.[campaign] = ud.[campaign]
March 30, 2021 at 1:57 pm
The data going into the function is in the form like 17:03:26 .... Here is my stored procedure but it probably needs some work:
USE [a2wh]
GO
SET ANSI_NULLS ON
GO
SET...
March 29, 2021 at 7:33 pm
Here is the function:
CREATE FUNCTION [dbo].[fnGetSeconds]
(
@TimeFormatted varchar(10)
)
RETURNS decimal(10, 2)
AS
BEGIN
RETURN
(SELECT (LEFT(@TimeFormatted,2)*3600) +
ROUND(DATEDIFF(MS, 0, '00' + RIGHT(@TimeFormatted,LEN(@TimeFormatted)-2))/1000.0,0)
...
March 29, 2021 at 5:53 pm
My apologies, and I need to back up here as I over-simplified my base challenge and its code. I have a query that will be used as the datasource for...
March 29, 2021 at 4:51 pm
Excellent tool! If I wanted to not hardcode the dates how could I declare and pass these in as variables?
March 29, 2021 at 3:43 pm
What about this?:
Update A Set A.[Fname] = B.[Fname]
from [Reporting].[dbo].[D02_CallLog] A
inner join [Reporting].[dbo].[D02_CallLog] B
on A.[CallID] = B.[CallID]
where...
March 2, 2021 at 7:46 pm
Would a Self Join be in order OR something like this ?:
UPDATE [Reporting].[dbo].[D02_CallLog] A
SET A.[Fname] = (SELECT B.[Fname] FROM [Reporting].[dbo].[D02_CallLog] B)
WHERE A.[CallID] = B.[CallID] and A.[Fname]...
March 2, 2021 at 7:33 pm
CREATE TABLE [Reporting].[dbo].[D2_CallLog](
[ID] [Int] NOT NULL,
[Fname] [nvarchar](255) NULL,
[Lname] [nvarchar](255) NULL,
[CallID] [int] NULL,
CONSTRAINT [PK_D02CallLog] PRIMARY KEY CLUSTERED
(
[ID] ASC
)...
March 2, 2021 at 6:49 pm
fnGetSeconds takes time in 00:00:00 format and turns it into seconds:
ALTER FUNCTION [dbo].[fnGetSeconds](@TimeFormatted varchar(10))RETURNS decimal(10, 2)ASBEGINRETURN(SELECT (LEFT(@TimeFormatted,2)*3600) +ROUND(DATEDIFF(MS, 0, '00' + RIGHT(@TimeFormatted,LEN(@TimeFormatted)-2))/1000.0,0)AS 'TimeSeconds')END
January 6, 2021 at 7:29 pm
then it seems like this should work:
SELECT * FROM (
SELECT agent, dbo.fnGetSeconds(CALL_TIME)
FROM
[a2wh].[dbo].[CallLogCommon]
) t
pivot (
SUM(dbo.fnGetSeconds(CALL_TIME))
...
December 14, 2020 at 6:40 pm
Solved... there were no NULLS but one value was ''
December 4, 2020 at 4:46 pm
I changed the function to have a length of 10 rather than MAX but the error persists:
CREATE FUNCTION [dbo].[fnGetSeconds]
(
@TimeFormatted varchar(10)
)
RETURNS decimal(10, 2)
AS
BEGIN
RETURN
(SELECT (LEFT(@TimeFormatted,2)*3600)...
December 4, 2020 at 3:40 pm
No nulls in the data but there are some that are 00:00:00
December 4, 2020 at 3:34 pm
Viewing 15 posts - 151 through 165 (of 391 total)