SQL Server Performance

export to CSV file without column headers

Discussion in 'ALL SQL SERVER QUESTIONS' started by hayko98, Jan 30, 2012.

  1. hayko98 New Member

    Hi all,
    I am trying to create a report and export to CSV file without column headers.When i run the query from SSMS and 'SAVE RESULTS AS..' CSV or text file it saves without headers.But when i am createing a job to run the query ,it exports with headers.I sat up OUTPUT Format (from Tools\Query Results\results To Text\Comma delimeted\unchecked Include column headers ....It still exports with headres.Any ideas how to do this?
  2. davidfarr Member

    Which version of SQL Server are you running ?
    From SQL Server 2008 Management Studio:
    Right-click a database -- Tasks -- Export Data... -- then follow the wizard prompts.
    The wizard steps offer a "Flat File Destination" and prompts you with a checkbox option to include/exclude "Column names in the first data row" and also an option to "Save SSIS package"
    You can then save that package and set it to execute on demand, or on a regular schedule using the SQL Server Agent.
  3. satya Moderator

    ...just to addup, make sure you are using SQL 2008 Management studio and not SQLExpress edition one.
  4. hayko98 New Member

    Thank you guys all for for your responds.
    I am running SQL 2008 developers eddition.
    I used Export Data to create SSIS pakage.I saved (file system) then created a Agent job.But job fails.Here is the error message:

    Message
    Executed as user: NT AUTHORITY\NETWORK SERVICE. Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 32-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 10:13:22 AM Error: 2012-01-31 10:13:22.40 Code: 0xC0011007 Source: {25854D68-FAF9-441B-8EDF-ECBB2ECE1FC8} Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted. End Error Error: 2012-01-31 10:13:22.40 Code: 0xC0011002 Source: {25854D68-FAF9-441B-8EDF-ECBB2ECE1FC8} Description: Failed to open package file "C:\Documents and Settings\Administrator\Desktop\testSSIS\testSSIS\bin\Deployment\testSSIS.dtsx" due to error 0x80070005 "Access is denied.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format. End Error Could not load package "C:\Documents and Settings\Administrator\Desktop\testSSIS\testSSIS\bin\Deployment\testSSIS.dtsx" because of error 0xC0011002. Description: Failed to open package file "C:\Documents and Settings\Administrator\Desktop\testSSIS\testSSIS\bin\Deployment\testSSIS.dtsx" due to error 0x80070005 "Access is denied.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format. Source: {25854D68-FAF9-441B-8EDF-ECBB2ECE1FC8} Started: 10:13:22 AM Finished: 10:13:22 AM Elapsed: 0.031 seconds. The package could not be found. The step failed.
  5. davidfarr Member

    This appears to be a permissions issue.
    The easiest solution, and one preferred by me for my own packages, is to re-do the SSIS package and save it to SQL Server (it is then stored in the msdb database), and not as a File System package. The Agent should have no problem then.
    Another option that you have is to change the SQL Agent service account to a different user, local or domain user, that has local Administrator permissions on the SQL Server. The Agent can then access any file on the server.
    If you don't like either of the above, then you need to at least be sure the package file exists and that the Agent Service account has permissions to read it;
    Open Windows Explorer, navigate to the folder in question "C:\Documents and Settings\Administrator\Desktop\testSSIS\testSSIS\bin\Deployment\" and confirm that the "testSSIS.dtsx" file is actually there. If it is there, then be sure that the NT AUTHORITY\NETWORK SERVICE has permissions on the file or folder. Right-click the file or folder -- Properties -- Security Tab -- Add the Network Service User with Read permissions.

Share This Page