Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 XP_CMDSHELL

Author  Topic 

rakesh4u
Starting Member

3 Posts

Posted - 2008-08-05 : 01:37:53
can any body help as how to handle the error messages and errors thrown by xp_cmdshell. i'm using a dynamic sql with bcp in it to load some files and want to stop the file load if any error occurs and roll back all the data that has been inserted into the table.

Thanks,
Rakesh

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-05 : 01:40:00
You can catch the error like this:

EXEC @rc = master.dbo.xp_cmdshell @cmd

IF @rc ...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -