모든 객체를 Recompile하는 SP > db

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

db

모든 객체를 Recompile하는 SP

페이지 정보

작성자 서방님 댓글 0건 조회 472회 작성일 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 서방님 480 10-16
148 서방님 465 10-16
열람중 서방님 473 10-16
146 서방님 359 10-16
145 서방님 503 10-16
144 서방님 412 10-16
143 서방님 418 10-16
142 서방님 526 10-16
141 서방님 391 10-16
140 서방님 1212 10-16
139 서방님 419 10-16
138 서방님 492 10-16
137 서방님 464 10-16
136 서방님 468 10-15
135 서방님 485 09-21
게시물 검색

회원로그인

접속자집계

오늘
1,214
어제
3,689
최대
26,974
전체
545,599
Latest Crypto Fear & Greed Index

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