sql server 2008 r2 - return modified value from a database table -
i in situation need fetch data table , condition need change data. exp. if column has value 0 return '-' else return actual value
here example
declare @aa int=0 declare @ww nvarchar='-1' select @aa select case when @aa=0 cast(@ww nvarchar) when @aa>0 @aa end aa
but return 0 if value 0.
please me.
try this
declare @aa int=0 declare @ww nvarchar(10) = '-1' select case @aa when 0 @ww else @aa end aa
Comments
Post a Comment