欢迎光临
我们一直在努力

如何把"用户定义的数据类型"的ower改为dbo?-数据库专栏,SQL Server

建站超值云服务器,限时71元/月

方法1.先删除,再重新建立
  if exists (select * from dbo.systypes where name = ndt_ac_area)
  exec sp_droptype nssn
  go
  setuser –默认是dbo
  go
  exec sp_addtypendt_ac_area, nchar (3), nnot 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

 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 如何把&quot;用户定义的数据类型&quot;的ower改为dbo?-数据库专栏,SQL Server
分享到: 更多 (0)