Helper database CLR functions