Is it a good idea to have multiple jobs in one stored procedure?
<p>What is the best practice about this situation?</p>

<p>I want to do multiple DIFFERENT operations on a single entity in my database.I want to insert data, delete rows and etc(basic functionalities only) and I was wondering if it is a good idea to do all of them in one stored procedure using a flag parameter like this:</p>

<pre><code>CREATE PROCEDURE usp_entity
    @flag INT
    @id AS INT = 0
    @field AS VARCHAR = NULL
AS
BEGIN
    IF @flag = 1
    INSERT INTO entity (field) VALUES (@field)
    ELSE IF @flag = 2
    DELETE FROM entity WHERE id = @id
END
</code></pre>

<p>Or is it better to create different stored procedures like <code>ups_entity_insert</code> and <code>usp_entity_delete</code> to accomplish these tasks?</p>

<p>The reason I am asking this is because one of our teachers did the first approach the other day and I am not sure if it is the right way</p>