Link to home
Start Free TrialLog in
Avatar of NigelRocks
NigelRocks

asked on

If Statement Causing Problems

Experts,

I have a fairly long T-SQL script that works perfectly until I try to put in a simple If statement (see attached code).

When it test whether @!i is not equal to 96, the script hangs on me.  Why would this be?
SET @i = 81
while  @i < 108
begin
	if @i <> 96
	Begin
		INSERT INTO dbo.HRAGroupAnswer (HragqID, HraaoID, Gotogroupquestion)
		VALUES (204, @i, NULL)  -- Question 4 
		SET @i = @i + 1
	end
end

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NigelRocks
NigelRocks

ASKER

D'oh!