Why does this query return *?

7

Why does this query return me * ?

select convert(varchar(2), 141)

I thought it was the ascii table, but the 141, does not match the *.

I use SQL Server 2008 R2

    
asked by anonymous 19.02.2015 / 17:10

1 answer

9

When integers are implicitly converted to a character data type, if the integer is too large to fit in the character field, SQL Server returns character 42 of the ASCII Table, the asterisk (*). >

Soon any number larger than 2 characters will return * . If you want to display 141, just increase the number of characters:

select convert(varchar(3), 141)

Return: 141.

Source: Technet

    
19.02.2015 / 17:47