Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Error converting datatype varchar to float

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-12-14 : 08:01:16
TReb writes "Hi.. i've got a problem upon executing my stored proc... pls somebody help regarding this issue... thanks...

===> Upon exution of this SP and found zero(0) in "DEVIATION" column, it come to errror





CREATE PROCEDURE SP_TD_RATE


@FILENAMEx nvarchar(50), @BRANCHCODE nvarchar(3), @SYSID nvarchar(1),
@AMTLEAST float, @AMTMOST float, @TERMLEAST float, @TERMMOST float,@RATE float, @DEVIATION float , @TAG nvarchar (5)


AS

IF (Select COUNT(RATE) from T_TD_RATE where SYSID=@SYSID and AMTLEAST='@AMTLEAST' and AMTMOST='@AMTMOST' and TERMLEAST='@TERMLEAST' and TERMMOST = '@TERMMOST' and RATE='@RATE' and DEVIATION='@DEVIATION' and TAG='@TAG') < 1

BEGIN

INSERT into T_TD_RATE (FILENAMEx, BRANCHCODE, SYSID, AMTLEAST, AMTMOST,TERMLEAST,TERMMOST,RATE,DEVIATION,TAG)

values (@FILENAMEx, @BRANCHCODE, @SYSID, @AMTLEAST,@AMTMOST,@TERMLEAST,@TERMMOST,@RATE,@DEVIATION,@TAG)

END
GO"

JoeNak
Constraint Violating Yak Guru

292 Posts

Posted - 2006-12-14 : 08:19:59
First you need to remove the single quotes around the variables in the SELECT in your IF statement. It's really difficult to troubleshoot your insert statement without the DDL and the param values you're passing that fail. Double check your datatypes in T_TD_RATE.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-14 : 09:02:53

1 As said you should wrap variable with single quotes
2 You can make use of not exists
If not exists(Select * from ....)
Begin
....
End

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -