2014-02-20 37 views
0

我正在用SQL Report Services構建一些報告。我有此查詢:查詢中的SSRS參數代碼衰減性能?

select 
FromPhone.PhoneUri as FROM_PHONE, 
Agente.UserUri as AGENTE, 
IVRSession.InviteTime as INVITE, 
AgenteSession.ResponseTime as RESPONSE_TIME, 
AgenteSession.SessionEndTime AS END_TIME, 
DATEDIFF(SECOND,AgenteSession.ResponseTime, AgenteSession.SessionEndTime) as DURATA, 
DATEDIFF(SECOND,IVRSession.InviteTime, AgenteSession.ResponseTime) as ATTESA, 
AgenteSession.ResponseCode as RESPONSE_CODE 

from 
SessionDetails as IVRSession 

join VoipDetails on IVRSession.SessionIdTime = VoipDetails.SessionIdTime and IVRSession.SessionIdSeq = VoipDetails.SessionIdSeq 
left outer join Phones as FromPhone on FromPhone.PhoneId = VoipDetails.FromNumberId 
left outer join Phones as ConnectedPhone on ConnectedPhone.PhoneId = VoipDetails.ConnectedNumberId 

join SessionDetails as AgenteSession on AgenteSession.ReplacesDialogIdTime = IVRSession.SessionIdTime and IVRSession.SessionIdSeq = AgenteSession.ReplacesDialogIdSeq 


left outer join Users as User1 on User1.UserId = IVRSession.User1Id 
left outer join Users as User2 on User2.UserId = IVRSession.User2Id 
left outer join Users as Agente on Agente.UserId = AgenteSession.User1Id 


left outer join ClientVersions as Client1Version on Client1Version.VersionId = IVRSession.User1ClientVerId 
left outer join ClientVersions as Client2Version on Client2Version.VersionId = IVRSession.User2ClientVerId 

    where 


(Client1Version.ClientType = 1024 or Client2Version.ClientType = 1024) and 
User2.UserUri = '[email protected]' and 
IVRSession.InviteTime > '15/01/2014' and IVRSession.InviteTime < '20/02/2014' 

在這種形式的所有工作正常,但... 如果我在

IVRSession.InviteTime > '15/01/2014' and IVRSession.InviteTime < '20/02/2014' 

使用兩個SSRS參數(@DataDa和@DataA)而不是字符串結果時間更多。類似於> 1分鐘

爲什麼這種行爲?

回答