sql server - T-SQL: convert varchar to numeric -


this might simple query not expected here ask. if question wrong, please forgive

enter image description here

on above, fetching date field converted numeric(6), empty returning 0. trying use blank space instead of 0

i tried casting (i may wrong):

 select       isnull(date_disqualified, cast('' numeric)) date_disqualified  tablea 

and played type of casting numeric varchar, or int no luck @ all.

can please me ,what doing wrong or how make work?

this piece made day:(answer)

isnull (cast([date_disqualified] varchar(6)), ' ') 

thank all

if want blank space, entire column needs character. basically:

select (case when date_disqualified null ''              else convert(varchar(255), date_disqualified, 120)         end) 

i'm not sure why want return value number if string. should use convert() convert value string want.


Comments

Popular posts from this blog

php - Auto increment employee ID -

php - isset function not working properly -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -