Hello All! I'm having an issue trying to set variable in SQL in a stored procedure. I'm checking to see if a record is set to active, and the idea is to set it to inactive or vice versa.
Admittedly I'm not the best with SQL and have tried CASE statements along with my example, but nothings working...
Could someone show me what I'm missing???
Thanks!!!
ALTER Procedure [dbo].[spAlterStatus]
@CID as int,
@Active varchar(10)
AS
select @Active = Active from Course where
CID = @CID;
if @Active='0' set @Active = '1';
if @Active='1' set @Active = '0';
UPDATE Course
SET Active = @Active WHERE CourseID = @CourseID