Hi I am using the following code to export data from SQL to an excel file. I wish to have it order by the first column when ever I open the excel file. How can I do it running this code?Exec Master..xp_cmdshell 'bcp "SELECT ''CutomerID'',''LastName'',''FirstName'',''date'' UNION ALL (Select [CutomerID], [LastName], [FirstName], convert(varchar,[date]) from Tbl_Memory order by CutomerID)" queryout "\\servername\Reports\Customers.xls" -c'