fix sql error in ms sql server
revert #239
feature#260