Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Stored Procedure Fix
    primarykey
    data
    text
    <p>Basically my stored procedure below will check the users when they login to the game if they have enough points at specific level and if they have less than what we require for that level, the procedure will fix their points and add them the required @NewPoint to make them @Total = to how much they should have at that level. The script below works correctly, so If they have less @Total points it will update their heros correctly but if they have normal points = and not less &lt; then the script will try to insert NULL to the database and it will fail. So, basically I need help with setting something in this script, so if they have @Total points and not less then what it is specified to abort the script or make something like it will do nothing.</p> <pre><code>ALTER PROCEDURE [dbo].[REPAIR_USER_STAT_POINTS] @strUserID varchar(21) AS DECLARE @Level int, @Point int, @Class int,@NewPoint int, @Strong int, @Sta int, @Dex int, @Intel int, @Cha int, @Total int SELECT @Level = Level, @Class = Class, @Point = Points, @Strong = Strong, @Sta = Sta, @Dex = Dex, @Intel = Intel, @Cha = Cha FROM USERDATA WHERE strUserId = @strUserID SET @Total = SUM(@Strong + @Sta + @Dex + @Intel + @Cha + @Point) IF @Level = 61 AND @Total &lt; 482 BEGIN SET @NewPoint = 10 END IF @Level = 62 AND @Total &lt; 487 BEGIN SET @NewPoint = 15 END IF @Level = 63 AND @Total &lt; 492 BEGIN SET @NewPoint = 20 END IF @Level = 64 AND @Total &lt; 497 BEGIN SET @NewPoint = 25 END IF @Level = 65 AND @Total &lt; 502 BEGIN SET @NewPoint = 30 END IF @Level = 66 AND @Total &lt; 507 BEGIN SET @NewPoint = 35 END IF @Level = 67 AND @Total &lt; 512 BEGIN SET @NewPoint = 40 END IF @Level = 68 AND @Total &lt; 517 BEGIN SET @NewPoint = 45 END IF @Level = 69 AND @Total &lt; 522 BEGIN SET @NewPoint = 50 END IF @Level = 70 AND @Total &lt; 527 BEGIN SET @NewPoint = 55 END IF @Level = 71 AND @Total &lt; 532 BEGIN SET @NewPoint = 60 END IF @Level = 72 AND @Total &lt; 537 BEGIN SET @NewPoint = 65 END IF @Level = 73 AND @Total &lt; 542 BEGIN SET @NewPoint = 70 END IF @Level = 74 AND @Total &lt; 547 BEGIN SET @NewPoint = 75 END IF @Level = 75 AND @Total &lt; 552 BEGIN SET @NewPoint = 80 END IF @Level = 76 AND @Total &lt; 557 BEGIN SET @NewPoint = 85 END IF @Level = 77 AND @Total &lt; 562 BEGIN SET @NewPoint = 90 END IF @Level = 78 AND @Total &lt; 567 BEGIN SET @NewPoint = 95 END IF @Level = 79 AND @Total &lt; 572 BEGIN SET @NewPoint = 100 END IF @Level = 80 AND @Total &lt; 577 BEGIN SET @NewPoint = 105 END IF @Level = 81 AND @Total &lt; 582 BEGIN SET @NewPoint = 110 END IF @Level = 82 AND @Total &lt; 587 BEGIN SET @NewPoint = 115 END IF @Level = 83 AND @Total &lt; 592 BEGIN SET @NewPoint = 120 END ELSE @NewPoint = @NewPoint IF @Class = 201 OR @Class = 205 OR @Class = 206 OR @Class = 101 OR @Class = 105 OR @Class = 106 BEGIN UPDATE USERDATA Set Strong = '247',Dex = '60',Sta = '65',Intel = '50',Cha = '50',Points = @NewPoint WHERE strUserId = @strUserId END ELSE IF @Class = 202 OR @Class = 207 OR @Class = 208 OR @Class = 102 OR @Class = 107 OR @Class = 108 BEGIN UPDATE USERDATA Set Strong = '60',Dex = '252',Sta = '60',Intel = '50',Cha = '50',Points = @NewPoint WHERE strUserId = @strUserId END ELSE IF @Class = 203 OR @Class = 209 OR @Class = 210 OR @Class = 103 OR @Class = 109 OR @Class = 110 BEGIN UPDATE USERDATA Set Strong = '50',Dex = '70',Sta = '50',Intel = '70',Cha = '232',Points = @NewPoint WHERE strUserId = @strUserId END ELSE IF @Class = 204 OR @Class = 211 OR @Class = 212 OR @Class = 104 OR @Class = 111 OR @Class = 112 BEGIN UPDATE USERDATA Set Strong = '65',Dex = '60',Sta = '65',Intel = '232',Cha = '50',Points = @NewPoint WHERE strUserId = @strUserId END </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload