public static SqlInt32 Sign(SqlDecimal n) { n.AssertValid(); if (n.IsNull) return SqlInt32.Null; if (n == new SqlDecimal(0)) return SqlInt32.Zero; else return n.IsNull ? SqlInt32.Null : (n.IsPositive ? new SqlInt32(1) : new SqlInt32(-1)); }