-
exporting data from MSSQL 2K
other than dts, is there a way to export data from a table in sql to a text file on the OS? our oracle dba mentioned something about spooling in oracle and we were curious if mssql had any alternatives for exporting.
-
You can use "bcp", which is a command line utility for SQL Server. You can use it like this:
bcp YourDatabase..YourTable out c:\YourTextFile.txt -c -Uuser -Ppassword -Sserver
Type "bcp /?" from the command line to see all other options.
You can also use "osql", another command line utility that allows you to execute sql commands:
osql -Uuser -Ppassword -Sserver -Q"select * from YourDatabase..YourTable" > c:\YourTextFile.txt
This will include column headers, whereas bcp will not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|