Microsoft SQL Server Export data in txt file by using SQLCMD By using SQLCMD on Command Prompt

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Command Structure is

sqlcmd -S yourservername\instancename -d database_name -o outputfilename_withpath -Q "your select query"

Switches are as follows

-S for servername and instance name

-d for source database

-o for target outputfile (it will create output file)

-Q for query to fetch data



Got any Microsoft SQL Server Question?