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.
| 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 errrorCREATE 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)ASIF (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') < 1BEGININSERT 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)ENDGO" |
|
|
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. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-12-14 : 09:02:53
|
| 1 As said you should wrap variable with single quotes2 You can make use of not existsIf not exists(Select * from ....)Begin....EndMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|