I'm developing a customised version of the xp_cmdshell SP (used in SQL Server 6.5)
Whats the trick to capturing the output as generated by a command that is exec'ed eg. if a command like "DIR *.*" is passed to the stored procedure, this is passed to CMD.exe (using the /C option) and executes in a command shell - how can I trap the output (presumedly streamed to StdOut) so that I can pass the output back to the users workstation.
I would prefer not to pipe the output into a file then re--read the file and send it back - I want to pick up the output directly (for performance reasons)
Any hints or tips would be appreciated.