Using the BCP command I am generating files of SQL Server DB tables. The BCP command creates an empty file for each table when it's unable to dump data into the files. This can be caused by an error in query written or an empty variable is passed to the BCP command.
Is there any way we can capture these events as errors and make it return some error code?
I am performing this from a stored procedure. Is there any way I can handle this in SP?