September 2008
Intermediate to advanced
720 pages
20h 42m
English
A BCP script is simply a batch file or a Windows Script Host file that contains BCP commands. Example 11-3 shows examples of how to run BCP using various scripting options. If you do not know how to use batch files or Windows Script Host, two great resources are Windows Command-Line Administrator’s Pocket Consultant, 2nd Edition (Microsoft Press, 2008) and Windows 2000 Scripting Guide (Microsoft Press, 2003).
Example 11-3. Using BCP in a Script
sched-export.bat
@echo off @if not "%OS%"=="Windows_NT" goto :EXIT bcp pubs..customer out customers.txt -c -t, -T :EXIT
sched-export.vbs
'Nightly Bulk Copy export for the customers table 'Writes output to cust.txt and errors to err.txt Set ws = WScript.CreateObject("WScript.Shell") ret = ws.Run("bcp ...Read now
Unlock full access