With help from the forum I was able to remove the header and footers from my query outputs, but I am stuck again. I was trying to write my query in the new query edit window which I did to use the alias's. I need to remove the trailing spaces in each column so looking for best way, can I right click the view that the query creates and then click script view as "update to" or something else to add a TRIM() function to each field?
If you're referring to this thread:
You can add the -W parameter to SQLCMD, or use the bcp utility as suggested. If all you're doing in your command script is to output data to CSV, bcp is a better option than SQLCMD.