Question: how to export table data into text file in sql server?
Answer: If you want to save the results in a txt file, you can do this in SSMS. Go to Tools>Options:
Select the option Result to file:
Create a query and execute the query. ... 
The result saved are the following:
SQLCMD. ... 
PowerShell. ... 
Import/Export Wizard in SSMS. ... 
You will open the SQL Server Import and Export wizard: