Home Forums SQL Server 2008 T-SQL (SS2K8) Need help with a script to identify count of negative and positive numbers in a record RE: Need help with a script to identify count of negative and positive numbers in a record
Michael Valentine Jones
SSC Guru
Points: 64818
More actions
November 19, 2012 at 10:20 am
#1560443
This should work also:
select
abs(sign(col1)+sign(col2)+sign(col3)+
sign(col4)+sign(col5)) as NegativeCount
sign(col1)+sign(col2)+sign(col3)+
sign(col4)+sign(col5)+5 as PositiveCount
from
MyTable