fix sql server script for document