How to Export SQL Table Data To A Text File
To export SQL Server table data to a text file, we will use NORTHWIND Database and SQL Server Management Studio 2014.
Step-I: Open SQL Server Management Studio and Click on Connect button to connect to SQL Server instance.

Step-II: Expand Databases, right-click on NORTHWIND database(for this demo), move cursor to Tasks and then Export Data on the pop-up window as shown below.

Step-III: SQL Server Import and Export Wizard will open, Click on Next button.

Step-IV:
- Choose Data Source as SQL Server Native Client 11.0
- Select Server Name.
- To select Authentication, Either Select Use Windows Authentication or Use SQL Server Authentication radio button.
- Select Source Database from where you want to export table data.
- Click on Next button.

Step-V:
- Select Flat File Destination to export in Text File.
- Browse File name.
- Format should be Delimited.
- Check the checkbox Column names in the first row.
- Click on Next button.

Step-VI: Choose Copy data from one or more tables or views or Write a query to specify the data to transfer.
Click on Next button.

Step-VII: If you check Write a query to specify the data to transfer radio button, then a new window will open where you write a query and click on Parse button to check the validity of query and click on Next button.

Step-VIII:
- Select Source table from drop down.
- {CR}{LF} Row delimiter as shown in below image.
- Comma(,) as Comma delimiter.
- Click on Preview button if you want to preview the result.
- Click on Next button.

Step-IX: Check the Run Immediately check box and Click on Next button.

Step-X: Click on Finish button.

Step-XI: Process will be executed and completed successfully as shown in the following image, with the rows inserted.

Step-XII:
- Click on Close button to close SQL Server Import and Export Wizard.
- Check your text file where you exported data.