2016-06-07 4 views
-2

내 전체 코드입니다 : 난 항상 @Avg_transaction_Per_CSR을 얻고있다나누기 두 개의 숫자 여기

declare @total_csr as int 
declare @total_Transaction as int 
declare @Avg_days_Open as decimal(18,8) 
Declare @Avg_transaction_Per_CSR as int 

SELECT @total_csr = COUNT(*) FROM [APMRS_RG2].[dbo].pdmmast p where Plan_Num in ('510') and 
MONTH(p.Statdate) = @month and YEAR(p.statdate) = @Year 

---- Total Transactions -------- 
SELECT @total_Transaction = SUM(cast(transaction_count as int)) FROM [APMRS_RG2].[dbo].pdmmast p where Plan_Num in ('510') and 
MONTH(p.Statdate) = @month and YEAR(p.statdate) = @Year 

---- AVG Transaction Per CSR 
select @Avg_transaction_Per_CSR = CAST(@total_Transaction as decimal(18,8))/CAST(@total_csr as decimal(18,8)) 

0

예는 다음과 같습니다 @@ total_Transaction = 5 @Total_CSR = 26

+1

의 종류,'@의 opendays'는 어떤 데이터 유형을 의심? – Lamak

+0

오픈 일의 유형? –

+1

무엇을 말하지 않습니까? – scsimon

답변

2

나는 @opendays

Declare @opendays as decimal(18,8)) 
+0

이것은 대부분의 경우입니다. 나는'@ opendays'가 그의 코드에서''INT''라고 의심합니다. 당신은 여분의')'를 가지고 있습니다. – scsimon

+0

예 십진법 (18,8) 자체로 @pendays가 있습니다. 여전히 0이됩니다. – user300485

+0

은'@total_Transaction = 0'입니까? – scsimon