sql to doc