troubleshooting Question

How to output SQL SQLCMD result to a file in Windows?

Avatar of Maria Torres
Maria Torres asked on
Microsoft SQL Server
9 Comments2 Solutions104 ViewsLast Modified:
I'm trying to mimic on how Oracle's send its SQL result to an a file when loading records to a table, creating indices, and creating tables in SQLCMD.

When creating a table in Oracle, we are able to generate an output file showing the structure of the table and the result which can either be that the creation of a table failed or all were successfully created.  When loading data to tables in Oracle, we can produce an output file stating how many records were read, how many records were loaded successfully, and the records that failed.  When creating indices in Oracle, we can produce an output file showing the indices that were created successfully, as well as those that failed.  (FYI, that we call these output files as log files.)

I'm trying to mimic the above abilities in SQLCMD but with no success.  I need to be able produce log files that shows what was performed correctly, along with a descriptive error message for those errors that may have occurred.  Can someone point me in the right direction?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros