Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

I need the command for cutting off decimals in a procedure

Newbie Spellweaver
Joined
May 8, 2004
Messages
54
Reaction score
0
Hey I'm wondering, what is the syntax for cutting off all decimals (not rounding) off a number? It's not FIX(), I have no clue what it could be but I guess it must be there. Also would this work if @NextLevel is declared as int or would @NextLevel/20 return an integer value as well?

IF @NextLevel/20=FIX(@NextLevel/20)

of course with FIX replaced by the appropriate command

Much appreciated
 
Newbie Spellweaver
Joined
Jan 25, 2006
Messages
24
Reaction score
0
Yes, two integers divided in SQL Server will return an integer result.
You need to cast the last one to a decimal, or just add .0 on the end:

IF @NextLevel / 20.0 = Round(@NextLevel / 20.0, 0, 1)

If you are checking if @NextLevel divides evenly by 20, you could also do this:

IF @NextLevel % 20 = 0

The % symbol in SQL Server is a 'mod' function, which divides two integers and returns the remainder only.
 
Last edited:
Back
Top