fix sql error in ms sql server
revert #239
issue#265