Question: how to export data from sql to text file?
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: