How Change the fraction setup | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How Change the fraction setup

How to make mssql server to give fraction by default Select 2.0/3.0
.666666 Select 2/3
0 –Srini
As long as you’re not using variables, you’ll have to use decimals on your numbers if you want decimals in the result. That’s just the way it is. DECLARE @test DECIMAL(16,10), @nr1 DECIMAL(16,5), @nr2 DECIMAL(16,5) SET @nr1 = 2
SET @nr2 = 3
SET @Test = @nr1 / @nr2 SELECT @Test Result: .6666666667

i think default datatype for nos i.e. select 2/3 cant be set as float.
u need to use 2.0/3.0 else DECLARE @var1 FLOAT,@var2 FLOAT
SET @var1=2
SET @var2=3
SELECT @var1/@var2