What is the difference between these two queries? Why do they give different results?
Query 1
DECLARE @test nvarchar
SET @test = CONVERT(nvarchar, FLOOR(10.5))
SELECT @test
Results:
['1']
Query 2
SELECT CONVERT(nvarchar, FLOOR(10.5))
Results:
['10']
That’s 1 character long so truncates its assigned value; add a (size)