use siawasedb
DECLARE @TABLE_NAME VARCHAR (50)
DECLARE @TABLE_OWNER VARCHAR (50)
DECLARE TCURSOR CURSOR
 
FOR SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'
FOR READ ONLY
 
OPEN TCURSOR FETCH NEXT FROM TCURSOR INTO @TABLE_NAME, @TABLE_OWNER
WHILE @@FETCH_STATUS = 0
BEGIN
    EXEC ('SP_CHANGEOBJECTOWNER ''[' + @TABLE_OWNER + '].[' + @TABLE_NAME + ']'', ''dbo''')
    FETCH NEXT FROM TCURSOR INTO @TABLE_NAME, @TABLE_OWNER
END
CLOSE TCURSOR
DEALLOCATE TCURSOR


-- 스토어 프로시저
--Exec sp_changeobjectowner 'guri.m_human', 'dbo'

+ Recent posts