ERP World
Lock이 발생하는 경우 Tree 형태로 해당 세션을 조회할 수 있는 쿼리이다. SET NOCOUNT ON; SET CONCAT_NULL_YIELDS_NULL OFF GO WITH Blockers (SPID, Blocked, Level, Batch, WaitType, LastWaitType) AS ( SELECT SPID, Blocked, CAST(REPLICATE('0', 4 - LEN(CAST(SPID AS VARCHAR))) + CAST(SPID AS VARCHAR) AS VARCHAR(1000)) AS Level, REPLACE(REPLACE(T.TEXT, CHAR(10), ' '), CHAR(13), ' ') AS Batch, R.WaitType, R.LastWaitType FROM sys.Sy..
MSSQL을 사용하다 보면 관리자 계정(SA)의 비밀번호를 잊어버리는 경우가 발생한다. 이떄는 아래의 절차로 비밀번호를 초기화 할 수 있다. - Open the command prompt - Run sqlcmd and press enter - Run a Transact-SQL (Below) command to add an existing account or a new account to the sysadmin server role. Replace DOMAIN\Username with the account you want to add. *NOTE: if you receive errors, I¡¯ve listed some common issues at the end of this article. EXEC s..
MSSQL을 사용하다 보면 잦은 데이터 수정/삭제로 인하여 Index fragmentation이 발생하여 성능이 저하될 수 있다. 이때는 Index Rebuild 작업을 통해 성능을 개선할 수 있다. 다음은 Index Rebuild를 위한 Procedure 이다. USE [Database name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SP_INDEX_MAINTENANCE_ENTERPRISE] AS DECLARE @RowThreshold INT DECLARE @PercentThreshold DECIMAL(38,10) /***************************************************..