DECLARE @tbl sysname
DECLARE tblcur INSENSITIVE CURSOR FOR
SELECT name FROM sysobjects
WHERE xtype = 'U' AND uid = user_id('Old_Owner_Name')
OPEN tblcur
WHILE 1 = 1
BEGIN
FETCH tblcur INTO @tbl
IF @@fetch_status <0
BREAK
EXEC sp_changeobjectonwer @tbl, 'Old_Owner_Name', 'New_Owner_Name'
END
DEALLOCATE tblcur
Showing posts with label table owner chaging. Show all posts
Showing posts with label table owner chaging. Show all posts
Monday, October 6, 2008
Subscribe to:
Posts (Atom)
