Put blank in sql server column with integer datatype -


i have table values 0, 1, 2, 3 , -1, -2, 9, 8, etc. want put "blank" in column number less 0, i.e. should show records , whereever position less 0 should show ''.

i tried using str made query slow. query looks this:

select case  when position < 0 '' else position end position, column2 (     select str (column1) position, column2 table ) t1 

can suggest better way show '' in column1? there other way around? can use instead of str?

update: column1 int type , not want put null empty string. know can't show empty string in int column have use cast. wanted sure should not slow down query, looking best option returns results in less time.

you can put case expression query, , replace str cast, this:

select     case when position < 0 '' else cast(column1 varchar(10)) end position ,   column2 mytable 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -