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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

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

javascript - Restarting Supervisor and effect on FlaskSocketIO -