BCP Out All Tables
BCP is a very good command line tool for quickly getting data in or out of a database or tables. The one line of script below uses an undocumented
stored procedure to go through each table in the NorthWind database, BCPing the contents of each table out to a file (in the format tablename.out
) on the G drive. You can of course change the database name as appropriate.
@Command1="master..xp_cmdshell 'BCP NorthWind.? out G:\?.out -S MyServer -U sa -P -n'"