sql - select case when isnull('sdas',0)=0 then 'hi' else 'bye' end as 'Value' -
the below query
select case when isnull('23',0)=0 'hi' else 'bye' end 'value' returns bye
but
select case when isnull('sdas',0)=0 'hi' else 'bye' end 'value' returns next error message in ms-sqlserver2008r2
msg 245, level 16, state 1, line 1 conversion failed when converting varchar value 'sdas' info type int. can clarify on stage gets conversion has been done
'23' can converted int on fly, 'sdas' don't. take string(varchar)-type variables:
select case when isnull('sdas','0')='0' 'hi' else 'bye' end 'value' sql sql-server tsql
No comments:
Post a Comment