我正在编写一个存储过程,如果列Field4
的值小于或等于25,我将在其中放置条件,打印它的批准矩阵,以及列的值{ {1}}大于25,打印相应的批准矩阵。
但这不起作用,即使Field4
的值大于25,它也会打印条件'小于或等于25'的批准矩阵。
列Field4
的数据类型为Field4
,我将其转换为浮点数,因为它包含的值例如为1400.00,25.79,24.01等。
nvarchar(max)
然而,当我写作时 -
ALTER Procedure [dbo].[mccspGetApprovalMatrix3]
@CaseId bigint
As
Declare @Query1 varchar(100)
Declare @Query2 Float
SET @Query1 = (Select Distinct [Group]
from usertogroupmapping
Where txtLoginId in (Select txtCreatedBy
from trnExecutionDetails
where intQueueFolderId = 2087
and intExecutionId = @CaseId))
SET @Query2 = (Select convert (Float, Field4)
from trnWebFormFieldsValues
Where Field4 IS NOT NULL
and flgActive = 1
and intQueueFolderId = 2087)
If @Query1 = 'E' OR @Query1 = 'F'
Begin
If @Query2 <= 25.00
Begin
Print 'L1- fpoint and dcoludro: L2- None: L3- None'
End
Else
Begin
Print 'L1- pmorrone: L2- soberlies: L3- fpoint and dcoludro'
End
End
显示正确的结果。
有人可以查看为什么它没有在存储过程中给出正确的结果吗?
提前致谢
Iftakhar Ahmad