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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-04-19 : 10:55:41
|
Steve writes "SET XACT_ABORT ONBEGIN TRANDeclare @mysql nvarchar(3000)Set @mysql = "insert into..."Exec sp_executesql @mysqlIF (@@ERROR <> 0)BEGIN GOTO tran_failure_blockENDSet @mysql = "delete from..."Exec sp_executesql @mysqlIF (@@ERROR <> 0)BEGIN GOTO tran_failure_blockENDSet @sql = 'Exec master..xp_cmdshell (Runs a BCP In/Out here)'Exec (@sql)IF (@@ERROR <> 0)BEGIN GOTO tran_failure_blockENDCOMMIT TRANRETURNtran_failure_block:BEGIN ROLLBACK TRAN RETURNENDGOThis is the meat of my stored procedure. Anyways, the problem is withthe last command (xp_cmdshell) which I use to run BCP in and out operations.Now, the problem is, if there is any error in the BCP, I can't catch it in the stored proc, as I would imagine, BCP runs out of process from sql server.I really want everything to go, or nothing to go and if there any errors in myxp_cmdshell bcp, I want to catch it and rollback the entire transaction.Any ideas???" |
|
|
|
|