Sep 15 2020 01:41 PM - edited Sep 15 2020 01:42 PM
Hi
I was relying on correct result of Try_Convert ( select try_convert(smallint,'+')), but instead of null, I've received 0 as a result. It is the same also with -
According to the documentation ( https://docs.microsoft.com/de-de/sql/t-sql/functions/try-convert-transact-sql?view=sql-server-ver15) this should be not possible. Bug or am I missing something ?
I've tried it on SQL 2012 (latest SP4) and SQL 2019 (latest CU)
Thanks,
Bobi
Sep 17 2020 04:52 AM
The result 0 is correct.
The plus and minus counts as numeric signs, an addition number is not mandatory here
Convert returns the same result
select convert(smallint, '+'), convert(smallint, '-')