how can i backup data from a query with MSSQL. I think about something like this:
BACKUP DATABASE 'sourceDB'
Select * from Table1 where Day = '12.01.2010';
TO DISK = 'F:\Program Files\Microsoft SQL Server\MSSQL\Backup\sourceDB.bak' WITH FORMAT
Thank you for your support!
Cheers
Stefan
If you have access to Management Studio, you can save query results to a file quite easily:
That's all there is to it.
The backup command is used to backup entire databases into a proprietary format.
To store the result of a query in a file, check out the bcp
utility. This allows you to run a query and store the result in a text file. One example:
bcp "SELECT * FROM Northwind.dbo.Customers" queryout "c:\text.txt" -c -T -x
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