¾È±Ô °øºÎ¹æ

MS-SQL > ÀúÀå ÇÁ·Î½ÃÁ® - System ÇÁ·Î½ÃÁ® - ³»¿ëº¸±â

µî·ÏÀÏ : 2017-07-03 19:28 Á¶È¸¼ö : 33,784

SQL ¼­¹ö¿¡¼­ °ü¸®ÇÏ´Â ¸ðµç RULE, DEFAULT,VIEW,SP, Triger µîµî,,,  
   
ÀÌ·± °´Ã¼µéÀº ¸ðµÎ MASTER µ¥ÀÌŸº£À̽ºÀÇ syscomments¶ó´Â ½Ã½ºÅÛ Å×ÀÌºí¿¡ ÀúÀåµÇ¾î ÀÖÀ¸¸ç,
Ŭ¶óÀ̾ðÆ®°¡ ÇØ´ç ¿ÀºêÁ§Æ®¸¦ »ç¿ëÇÏ´Â Äõ¸®¸¦ ¼­¹ö¿¡ º¸³»¸é ¼­¹ö¿¡¼­ ±× Á¤ÀǸ¦ Àо
ó¸®ÇÏ°Ô µË´Ï´Ù.
   
sp_helptext ½Ã½ºÅÛ ÇÁ·Î½ÃÁ®´Â syscomments Å×ÀÌºí¿¡ ÀúÀåµÈ ¿ÀºêÁ§Æ®ÀÇ Á¤ÀǸ¦ °£ÆíÇÏ°Ô
   
º¸¿©ÁÖ´Â ¿ªÇÒÀ» ÇÕ´Ï´Ù.
   
¾Æ·¡´Â sp_helptextÀÇ °£´ÜÇÑ ¹®¹ýÀ» º¸¿©ÁÖ°í ÀÖ½À´Ï´Ù.
     

¡á sp_helptext[@objname=] 'name'
 
     
   
¿©·¯ºÐµµ Äõ¸®ºÐ¼®±â¸¦ Àо °£´ÜÇÏ°Ô Å×½ºÆ® Çغ¸½Ã±â ¹Ù¶ø´Ï´Ù.
   
󸮰á°ú¸¦ º¸¸é ¾Æ½Ã°ÚÁö¸¸, ÇÁ·Î½ÃÁ®¶ó´Â °ÍÀº ¿ì¸®°¡  °øºÎÇÑ °¢Á¾ Transact-SQL ¹®À» ´«¸®ÀûÀÎ
󸮼ø¼­¿¡ µû¶ó¼­ ÀúÀåÇØ ³õÀº°ÍÀÓÀ» ¾Ë¼ö ÀÖ½À´Ï´Ù.
   
Áï, ½Ã½ºÅÛ ½ºÅä¾îµå ÇÁ·Î½ÃÁ®ÀÇ Á¤ÀǸ¦ ºÐ¼®ÇØ º¸¸é ¿©·¯ºÐÀÌ »ç¿ëÀÚ Á¤ÀÇ ÇÁ·Î½ÃÁ®¸¦ ¸¸µé¶§
¾öû³­ µµ¿òÀÌ µÉ°Í °°´Ù´Â »ý°¢ÀÌ µì´Ï´Ù.
   
Äõ¸®ºÐ¼®±â¸¦ ¿­¾î¼­ ¾Æ·¡Ã³·³ ½ÇÇàÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.
sp_detach_db ¶õ ½Ã½ºÅÛ ÇÁ·Î½ÃÁ®ÀÇ ³»¿ëÀ» º¸´Â ¿¹Á¦ ÀÔ´Ï´Ù.
   
   
sp_helptext sp_detach_db
 
create procedure sp_detach_db
	@dbname sysname = null,
	@skipchecks nvarchar(10) = null
	as
	declare @dbid int
	declare @exec_stmt nvarchar(540)
	
	if @dbname is null
		begin
			raiserror(15354,-1,-1)
			return(1)
		end

	if lower(@skipchecks) <> N'true' 
		and lower(@skipchecks) <> N'false' 
		and @skipchecks is not null
		begin
			raiserror(15354,-1,-1)
			return(1)
		end

	select @dbid = null
	select @dbid = dbid from master.dbo.sysdatabases where name=@dbname
	if @dbid is null
		begin
			raiserror(15010,-1,-1,@dbname)
			return(1)
		end

	-- make sure not trying to detach within a transaction
	if @@trancount > 0
		begin
			raiserror(226,-1,-1,'SP_DETACH_DB')
			return(1)
		end

	-- run UPDATE STATISTICS on all tables in the database so they are current
	-- when transferred to READONLY media
	if lower(@skipchecks) <> N'true' 
		begin
			print 'Running UPDATE STATISTICS on all tables'
			select @exec_stmt = 'USE ' + quotename( @dbname , '[') 
			+ ' exec sp_updatestats ' 
			exec (@exec_stmt)
		end

	select @exec_stmt = 'DBCC DETACHDB (' 
			+ quotename( @dbname , '[') 
			+ ')'
	exec (@exec_stmt)
	return (0) -- sp_detach_db	
            
            

ÇÁ·Î½ÃÁ®ÀÇ ³»¿ëÀÌ ÂÒ~¾Ç! ³ª¿À´Â°Å º¸À̽ÃÁ®.... µöµû ½Å±âÇÑ ÇÔ¼öµµ ¸¹ÀÌ ³ª¿À³×¿©... ¼~ºñ

¿Ö ÀÌ·¸°Ô °øºÎÇÒ°Ô ¸¹ÀºÁö....

±×·³, ÇÊ¿äÇÒ¶§ À¯¿ëÇÏ°Ô »ç¿ëÇÏ½Ã±æ ¹Ù¶ø´Ï´Ù.
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.