모든 객체를 Recompile하는 SP > db

본문 바로가기
사이트 내 전체검색

db

모든 객체를 Recompile하는 SP

페이지 정보

작성자 서방님 댓글 0건 조회 181회 작성일 07-10-16 15:56

본문

/******************************************************************************
   설  명 : 현재 DB의 모든객체를 Recompile한다.
   Ver           Date           Author                Description
   ---------  ----------  ---------------  ------------------------------------
   1.0            2005-11-21  최지환               1. 초기생성
 ******************************************************************************/

CREATE PROC dbo.sp_sys_recompile_all_currdb

                                        @i_table_pattern sysname = null

AS

             DECLARE            @v_rowcnt                       int

                           ,            @v_looper                        int

                           ,            @v_table                          nvarchar(200)

                           ,            @v_sql                             nvarchar(200)

 

             SET NOCOUNT OFF

 

             SELECT IDENTITY(int,1,1) as num                            ,

                                        name                                            as tablename

             INTO      #tables

             FROM    sysobjects

             WHERE  xtype     = 'U'

             AND                    name     LIKE ISNULL(@i_table_pattern, '%')

             SELECT @v_rowcnt = @@RowCount

             SELECT @v_looper = 1

 

             SET NOCOUNT ON

 

             WHILE @v_looper <= @v_rowcnt

             BEGIN

 

                           SELECT @v_table = tablename

                           FROM    #tables

                           WHERE  num       = @v_looper

 

                           EXEC sp_recompile @v_table

 

                           SELECT @v_looper = @v_looper + 1

             END

댓글목록

등록된 댓글이 없습니다.

Total 464건 22 페이지
db 목록
번호 제목 글쓴이 조회 날짜
149 서방님 104 10-16
148 서방님 180 10-16
열람중 서방님 182 10-16
146 서방님 117 10-16
145 서방님 178 10-16
144 서방님 153 10-16
143 서방님 151 10-16
142 서방님 169 10-16
141 서방님 132 10-16
140 서방님 933 10-16
139 서방님 149 10-16
138 서방님 180 10-16
137 서방님 164 10-16
136 서방님 179 10-15
135 서방님 178 09-21
게시물 검색

회원로그인

접속자집계

오늘
29
어제
302
최대
1,347
전체
155,090
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.