Nov 08 2017

Verifica le connessioni aperte nel DB

Category: TecnologiaAntonio @ 23:35


if object_id (‘tempdb..#OpenTranStatus’) is not null
        drop table #OpenTranStatus;
 
— Create the temporary table to accept the results.
CREATE TABLE #OpenTranStatus (
   ActiveTransaction varchar(25 ),
   Details sql_variant
   );
— Execute the command, putting the results in the table.
INSERT INTO #OpenTranStatus
   EXEC ( ‘DBCC OPENTRAN WITH TABLERESULTS, NO_INFOMSGS’ );
 
— Display the results.
SELECT * FROM #OpenTranStatus ;
GO

Rispondi