christer102
IS-IT--Management
Getting error converting to float when comparing (greater than) two values although both values are float. I have even tried to convert to values to float, and still getting the error (see down at the bottom).
CREATE PROCEDURE dbo.SetNTP as
SET QUOTED_IDENTIFIER OFF
declare @SQL varchar(8000), @minprem2 FLOAT, @premval VARCHAR(250)
select @SQL=QUERYNTP1, @minprem2=CONVERT(float,isnull(MINPREM2,0) ) FROM ATMCONFIG
SET @premval =' AND (convert(float,TOTCLIENTPREM)>convert(float,'+@minprem2+'))'
SET @SQL='UPDATE ACCOUNTINFO SET NTP = '+@SQL+ ' where ((MANAUT=1) or (MANAUT is null)) ' + @premval
EXEC(@SQL)
GO
Server: Msg 8114, Level 16, State 5, Procedure SetNTP, Line 5
Error converting data type varchar to float.
CREATE PROCEDURE dbo.SetNTP as
SET QUOTED_IDENTIFIER OFF
declare @SQL varchar(8000), @minprem2 FLOAT, @premval VARCHAR(250)
select @SQL=QUERYNTP1, @minprem2=CONVERT(float,isnull(MINPREM2,0) ) FROM ATMCONFIG
SET @premval =' AND (convert(float,TOTCLIENTPREM)>convert(float,'+@minprem2+'))'
SET @SQL='UPDATE ACCOUNTINFO SET NTP = '+@SQL+ ' where ((MANAUT=1) or (MANAUT is null)) ' + @premval
EXEC(@SQL)
GO
Server: Msg 8114, Level 16, State 5, Procedure SetNTP, Line 5
Error converting data type varchar to float.