sql >> データベース >  >> RDS >> Sqlserver

トランザクション分離レベルのスコープ

    以下を実行して、自分の目で確かめてください:

    CREATE PROCEDURE dbo.KeepsIsolation
    AS
    BEGIN
    PRINT 'Inside sproc that does not change isolation level';
    DBCC USEROPTIONS;
    END
    GO
    
    CREATE PROCEDURE dbo.ChangesIsolation
    AS
    BEGIN
    PRINT 'Inside sproc that changes isolation level';
    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
    DBCC USEROPTIONS;
    END
    GO
    SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
    DBCC USEROPTIONS;
    EXEC dbo.KeepsIsolation;
    DBCC USEROPTIONS;
    EXEC dbo.ChangesIsolation;
    -- demonstrates that isolation level restored to REPEATABLE READ after exiting the procedure
        DBCC USEROPTIONS;
    


    1. MySQLエラー10061

    2. FROM(UNIX_TIME)の場合のSQLの場合

    3. Postgresのヒントとコツ

    4. MySQL:主キーとしてDATETIMEを使用