Quick refactoring of the sql server export PS.