Hello again.
My fetch statement looks like this.
DECLARE r_cursor CURSOR
FOR SELECT * FROM rtemptable
OPEN r_cursor
FETCH NEXT FROM r_Cursor INTO @subdistcode,@itemcode,
@qtycases,@qtypcs,@amtcases,@amtpcs,@convfac
DECLARE @jj numeric, @jj1 numeric
WHILE @@FETCH_STATUS = 0
BEGIN
IF @qtypcs > @convfac
BEGIN
@JJ = DIV(@qtypcs / @convfac) -this would replace
the @qtycases
@JJ1 =MOD(@qtypcs /@convfac) -this would replace
the @qtypcs
INSERT rtemptable (col1,col2,col3,col4,
col5,col6,col7)
VALUES(@subdistcode,@itemcode,
@JJ,@JJ1,@amtcases,
@amtpcs,@convfac
FETCH NEXT FROM r_Cursor INTO
@subdistcode,@itemcode,
@qtycases,@qtypcs,@amtcases,
@amtpcs,@convfac
END
END
is this statement valid? Can I use values in the variables (@qtypcs and @convfac) in a condition(IF..ELSE) and replace the variables with the result of the condition (@JJ and @JJ1) and insert it in the same table (rtable) being used to fetch data?
many thanks for any enlightenment.
Randy : )
My fetch statement looks like this.
DECLARE r_cursor CURSOR
FOR SELECT * FROM rtemptable
OPEN r_cursor
FETCH NEXT FROM r_Cursor INTO @subdistcode,@itemcode,
@qtycases,@qtypcs,@amtcases,@amtpcs,@convfac
DECLARE @jj numeric, @jj1 numeric
WHILE @@FETCH_STATUS = 0
BEGIN
IF @qtypcs > @convfac
BEGIN
@JJ = DIV(@qtypcs / @convfac) -this would replace
the @qtycases
@JJ1 =MOD(@qtypcs /@convfac) -this would replace
the @qtypcs
INSERT rtemptable (col1,col2,col3,col4,
col5,col6,col7)
VALUES(@subdistcode,@itemcode,
@JJ,@JJ1,@amtcases,
@amtpcs,@convfac
FETCH NEXT FROM r_Cursor INTO
@subdistcode,@itemcode,
@qtycases,@qtypcs,@amtcases,
@amtpcs,@convfac
END
END
is this statement valid? Can I use values in the variables (@qtypcs and @convfac) in a condition(IF..ELSE) and replace the variables with the result of the condition (@JJ and @JJ1) and insert it in the same table (rtable) being used to fetch data?
many thanks for any enlightenment.
Randy : )