Let $A$ be a commutative ring. Then we get local rings $A_p$ by localizing at each prime ideal $p$. Moreover, we get $A_p \rightarrow A_q$ when $p$ contains $q$. So we get a big diagram indexed by the inclusion poset of prime ideals. When is $A$ the limit of this diagram?

When $A$ is a local ring or an integral domain it's true. I don't see any reason why it should be true for arbitrary rings. What's going on here?