How do I define my own hardcoded Ceilings and Floors in Sql Server? -


I have some SQL statements that calculate some numbers. It is possible (with bonus points / penalty points) that a person can get more than 100 (with bonus points) or 0 (with penalties) final scores.

How can I ensure that the value is calculated, if it is more than 100, then maximizes to 100. Alternatively, if the score is less than zero, then it is minus 0.

I'm assuming that I can use a simple UDF which does this math - it's not difficult, I'm not sure if it's already there?

I checked out and these two are doing other things, not what I am.

Thoughts?

Tes, it would be nice if SQL Server ANSI-SQL "horizontal" works in a consolidated way What exactly are others suggesting: " MIN (score, 100) ", etc. Unfortunately, it is not that you can not do this

Normal way This matter is with expression:

 Select  when the score between 0 and 100 hits when & lt; Bandscosm from your table as 0 THEN 0 ELSE 100 END  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -