The following code is in a stored procedure in SQL 6.5. The table cnt1056 has the following structure.
chapter varchar(4),
New1yr int,
New1yrR money,
New2yr int,
New2yrR money,
etc...
I am trying to update the count and monetary rebate amount based on the type of membership that was paid for (new1yr, new2yr, etc).
The first exec("Update...@cnt) for the count works great, increasing the count by one each time.
The second exec for the rebate is not working. I am sure it is because @rebate is money and everything else are strings but I can't work around it. I'd appreciate any help I could get.
DECLARE @reb varchar(10),
@cnt varchar(10),
@header varchar(4),
@REBATE MONEY
select @reb = "New1yrR"
select @cnt = "New1yr"
select @header = "0044"
select @rebate = 1
exec("UPDATE cnt1056 SET "+@cnt+" = "+ @cnt + "+1 WHERE Chapter = '"+@Header+"'"
exec("UPDATE cnt1056 SET "+@reb+" = "+ @reb + "+"+@Rebate +" WHERE Chapter = '"+@Header+"'"
chapter varchar(4),
New1yr int,
New1yrR money,
New2yr int,
New2yrR money,
etc...
I am trying to update the count and monetary rebate amount based on the type of membership that was paid for (new1yr, new2yr, etc).
The first exec("Update...@cnt) for the count works great, increasing the count by one each time.
The second exec for the rebate is not working. I am sure it is because @rebate is money and everything else are strings but I can't work around it. I'd appreciate any help I could get.
DECLARE @reb varchar(10),
@cnt varchar(10),
@header varchar(4),
@REBATE MONEY
select @reb = "New1yrR"
select @cnt = "New1yr"
select @header = "0044"
select @rebate = 1
exec("UPDATE cnt1056 SET "+@cnt+" = "+ @cnt + "+1 WHERE Chapter = '"+@Header+"'"
exec("UPDATE cnt1056 SET "+@reb+" = "+ @reb + "+"+@Rebate +" WHERE Chapter = '"+@Header+"'"