Using transaction locks in SQL Server 2012
Posted on 2013-12-17
I have written a stored procedure that executes an SSIS package in my SQL Server 2012 database. The SSIS package loads data from a file into a table when executed. If there is data in the table, it deletes the existing data and then writes the new data to the table. This was a great solution when only one user was using the stored procedure. Now more users are using this feature, and could possibly use it simultaneously. I need to somehow lock the execution of the stored procedure, if another user is in the middle of running it. How can I do this? Do I need to add syntax in my stored procedure that would prevent this from happening?
Thanks in advance,