Decimal round off to 0.5 in SQL Server

I recently had a requirement to round off a decimal value to 0.5 either higher side or lower side. Example: 1.4 the higher side round off should be 1.5 and lower side should be 1 same way 2.7 should round off to either 2.5 for lower side and 3 for the higher side. The solution is very simple. I thought it would help some one. This could be a good interview question too.

Prasad Sahoo

Prasad Sahoo, is an enthusiast of Microsoft technologies in general and a passionate database professional, mainly focusing on SQL Server performance tuning and business intelligence. He has contributed a long time of his career working on SQL Server and other RDBMS. If he is not busy with SQL stuff then he must be watching some Hollywood movies.

Leave a Reply

%d bloggers like this: