I am working with a sql server 2008 database through php with an odbc connection.
I am reading data files and logging them into the database but due to varied file sizes/layouts, my sql is somewhat automatically generated.
The sql is called in this order:
set autocommit to off
execute some sql
execute more sql
execute a SP.
commit
in my stored procedure I want to do error handling with a try catch like so:
BEGIN try
--sql
END try
BEGIN catch
rollback
END catch
I am wondering will this roll back only the sp and leave my other sql to commit or will it go back to the point where autocommit was set to off?
another possible solution would be to return a false/true from the stored procedure and use that to call a rollback from php. is this possible? if so, how does one return a value with a stored procedure?