Is there something like INTO...OUTFILE (from MySQL) in Microsoft SQL Server?
This code causes the query results to be dumped into a text file.
EXEC master..xp_cmdshell'bcp "SELECT TOP 5 CUSTOMERID FROM Northwind.dbo.Customers" queryout "c:\text.txt" -c -T -x'
References:
You can also use the sqlcmd or osql (in SQL 2000) to store the output from a command line outside of SSMS very like working with mysql from the command line. You just have to provide the correct parameters, including the query you want to run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With