Microsoft SQL Server By using SQLCMD on Command Prompt


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