如何把"用户定义的数据类型"的ower改为dbo?
发表于:2007-07-02来源:作者:点击数:
标签:
方法1.先删除,再重新建立 if exists (select * from dbo.systypes where name = N@#dt_ac_area@#) exec sp_droptype N@#ssn@# GO setuser --默认是DBO GO EXEC sp_addtypeN@#dt_ac_area@#, N@#char (3)@#, N@#not null@# GO 方法2.直接通过 数据库 全部山删
方法1.先删除,再重新建立
if exists (select * from dbo.systypes where name = N@#dt_ac_area@#)
exec sp_droptype N@#ssn@#
GO
setuser --默认是DBO
GO
EXEC sp_addtypeN@#dt_ac_area@#, N@#char (3)@#, N@#not null@#
GO
方法2.直接通过
数据库全部山删除SRX的 User Defined Data Types:
USE master
go
EXEC sp_configure @#allow updates@#, @#1@#
go
RECONFIGURE WITH OVERRIDE
go
use t --database name
go
begin transaction
delete systypes where uid=user_id(@#srx@#)
if @@rowcount<>0
commit transaction
else
rollback transaction
go
use master
go
EXEC sp_configure @#allow updates@#, @#1@#
go
RECONFIGURE WITH OVERRIDE
go
还忘记一点,如果你不想删除,你可以用第二种方法直接更新为DBO:
USE master
go
EXEC sp_configure @#allow updates@#, @#1@#
go
RECONFIGURE WITH OVERRIDE
go
use t --database name
go
begin transaction
UPDATE systypes SET UID=1 where uid=user_id(@#srx@#) --直接更新
if @@rowcount<>0
commit transaction
else
rollback transaction
go
use master
go
EXEC sp_configure @#allow updates@#, @#1@#
go
RECONFIGURE WITH OVERRIDE
go
原文转自:http://www.ltesting.net