sql - Positive values from Datediff without using ABS -


case 1 = 1 isnull(convert(varchar,datediff(day, date1, date2)),'') 

i need have positive values difference, when use abs wont work varchar type. need empty string null values.

why converting varchar()? actually, question looks vaguely familiar, , think warned using varchar() without length in sql server.

if need value string , positive, conversion after abs:

coalesce(cast(abs(datediff(day, date1, date2)) varchar(255)), '') 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -