Question

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']
Was it helpful?

Solution

DECLARE @test nvarchar

That's 1 character long so truncates its assigned value; add a (size)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top