Before you run the SQL script;
1. Create a folder on the server named: driveLetter\databasename
2. Enable xp_cmdshell by running sp_configure
3. Change fully qualified databasename for example: databasename.dbo.sysobjects to yourdatabasename.dbo.sysobjects
Hope this helps in bulk copying table data into formatted file...