I have a dbExecute that is trying to call a stored procedure that alters a database and I get this error:
ERROR caused by: ALTER DATABASE statement not allowed within multi-statement transaction.
I am saying {call myproc} and have the option set to call as a stored procedure. Also I have tried setting it to never commit, but it always gives me that error. How can I get this to work?
I managed to get it working by instead of calling as a procedure, I have exec myproc for the sql statement, transaction set = one statement, and call as stored procedure = false. This works, though I am confused as to why it doesn’t work when executed as a stored procedure when that is what it really is.
The DBCC SHRINKFILE statement produces a Result Set, however our code does not expect any Result Set to be returned. I can see two ways out of this.
Either adjust your procedure so that it does not produce any result sets, or
set the Result set output fields property on the DBExecute component - this way the component will expect there will be a result set returned and will not report it as an error. You will need to attach appropriate output edge to the component in this case.