Regular monomorphisms of schemes In the category of schemes, the equalizer of two morphisms $f,g : X \to Y$ is always a locally closed immersion into $X$ (since this is just $X \times_{Y \times Y} Y$ and $\Delta : Y \to Y \times Y$ is a locally closed immersion). What about the converse, is every locally closed immersion some equalizer? In other words, is every locally closed subscheme the locus where two maps agree?
Certaily every open immersion $U \to X$ is an equalizer, namely of the two maps $X \to X \cup_U X$. For closed immersions $Z \to X$, a similar construction works: The pushout $X \cup_Z X$ exists also in this case, see here, and is constructed locally, so that it is enough to remark that $A \to A/I$ is the coequalizer of the two maps $A \times_{A/I} A \to A$ in the category of rings. I general we have a composition of a closed immersion followed by an open immersion, but I'm not sure if we can do the same construction.
 A: Not quite an answer, but too long for a comment. Combining the two (open/closed) gluing constructions, we can conclude that if $Z$ is an open subscheme of a closed subscheme $W$ of $X$, then it is an equalizer: this is Tom's first comment. Now my point is that not every locally closed subscheme is of this form. 
Here is an example, which I see as a potential counterexample for Martin's question. Let $k$ be a field. Put $X=\mathrm{Spec}\,k[(T_n)_{n\in\mathbb{N}_{>0}}]$ and let $U$ be the complement of the origin $x$. For each $n>0$, let $Z_n\subset U$ be the $n$-th infinitesimal neighborhood of the "$n$-th basis vector" $e_n$. Put $Z=\bigcup_n Z_n$. This is a closed subscheme of $U$ (isomorphic as a scheme to $\coprod_n Z_n$) since if you invert $X_n$ you just get $Z_n$. But $Z$ is scheme-theoretically dense in $X$: if $f$ is a nonzero polynomial of degree $d$, its order of vanishing at $e_n$ cannot exceed $d$, hence the zero scheme of $f$ does not contain any $Z_{n}$ with $n>d$. So, the only closed subscheme of $X$ containing $Z$ is $X$, in which $Z$ is not open.
Remark: this implies that if  $\mathcal{I}\subset \mathcal{O}_U$ is the ideal sheaf of $Z$, and $j:U\to X$ is the inclusion, then  $j_\ast\mathcal{I}$ is not quasicoherent. In fact, the above argument applied to rational functions instead of polynomials shows that the stalk $(j_\ast\mathcal{I})_x$ is zero.
