Contents

1 ろる 螳 覲伎 螳豌 企蠍


1 ろる 螳 覲伎 螳豌 企蠍 #

set nocount on
set statistics io off

declare 
	@sql nvarchar(4000)
,	@new_schema nvarchar(500)
,	@old_schema nvarchar(500)
,	@type nvarchar(500)

set @old_schema = '_ろる'
set @new_schema = '襦_蟆螳_ろる'
set @type = 'U'

/* type貉手 譴 1螳 
select distinct type, type_desc from sys.all_objects

type type_desc
---- ------------------------------------------------------------
FN   SQL_SCALAR_FUNCTION
IF   SQL_INLINE_TABLE_VALUED_FUNCTION
F    FOREIGN_KEY_CONSTRAINT
U    USER_TABLE
SQ   SERVICE_QUEUE
D    DEFAULT_CONSTRAINT
S    SYSTEM_TABLE
P    SQL_STORED_PROCEDURE
PK   PRIMARY_KEY_CONSTRAINT
V    VIEW
IT   INTERNAL_TABLE
X    EXTENDED_STORED_PROCEDURE
PC   CLR_STORED_PROCEDURE
TF   SQL_TABLE_VALUED_FUNCTION
*/

declare cur cursor for
	select 
		'alter schema [' + @new_schema + '] transfer [' + @old_schema + '].[' + name + ']'
	from sys.all_objects
	where type = @type
	and [schema_id] = schema_id(@old_schema)

open cur
fetch next from cur into @sql

while @@fetch_status = 0
begin
	print @sql
	--exec(@sql) --ろる襯 蠍磯 蟆企襦 print蟆郁骸襯   覲旧->覿j鍵->ろ  襯 讌る 蟆 蟠ロ.
	fetch next from cur into @sql
end

close cur
deallocate cur