How to Create a Comma Separated Delimited Text File Using SQL Server 2008


6. In “Choose a Destination” wizard screen you need to choose destination as Flat File Destination from the drop down list. Next you need to browse and provide the name of the file which you created in the specific folder to store the data which gets exported from SQL Server 2008 to the text file. Select the Locale value from the drop down list as “English (United States)” and then you need to choose the appropriate code page, for this example the code page value chosen is “1252 (ANSI- Latin 1)”. Next to generate a delimited text file you need to choose Delimited as the format from the drop down list. There are basically three formats supported and they are Delimited, Fixed width and Ragged right. The Text qualifier filed can be left as default <none>. There is also an option available to have the column names as the first row within the delimited text file which will be generated, in order to get the column names as the first row you need to select the check box “Column names in the first data row” option as shown in the below snippet. Click Next to continue with the wizard.


 
7. Till now you have configured the data source and the destination within the wizard. Next will be to specify from which table or from which query result you want to export the data as a delimited text file. In “Specify Table Copy or Query” wizard screen there are two options available; the first one is “Copy data from one or more tables or views” and the second option is to “Write a query to specify the data to transfer”. If you want the entire data within the table to be exported then you can choose the first option. If you are interested in exporting the data from a query result then you need to choose the second option available within the wizard and provide the required query. Finally click next to continue with the wizard.

 

8. In “Configure Flat File Destination” wizard screen you can choose source table or view as Sales.Customer from the drop down list and then make sure that the value for Row delimiter is selected as “{CR}{LF}” and the value for Column delimiter is selected as “Comma {,}” as shown in the below snippet. 

 

On the same screen click on Edit Mappings… button to view the column level mapping details. Here you have the choice of either deleting all the rows in the destination file before the SalesCustomer.txt file is populated or you can even append the rows to the SalesCustomer.txt destination file. In this example “Append rows to the destination file” which is also the default option is used. Click OK to save the changes in Column Mapping screen.

 

In “Configure Flat File Destination” wizard screen you can click on Preview… button to preview the data which will be populated in the delimited flat file. Click OK to close the Preview Data screen. In the parent screen click next to continue with the wizard.

 
Continues…

Pages: 1 2 3




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |