来自前任所有者的 MS SQL 数据库表前缀
我有一个从公共服务器备份并在测试位置恢复以进行升级测试的 MS SQL 2000 数据库。问题是在公共服务器上具有访问权限的用户在测试服务器上不存在,现在所有表都以该用户名为前缀(这需要更改针对这些表的所有查询!)
有没有快速的方法解决这个问题吗?我已经更改了数据库所有者,但这没有帮助。
I have an MS SQL 2000 database that was backed up from a public server and restored at a test location for an upgrade test. The problem is that the user that had access permission on the public server does not exist on the testing server, and now all tables are prefixed with that username (which requires ALL queries against those tables to be changed!)
Is there any quick way to fix this? I have changed the database owner but this did not help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建登录名和用户,但从 sysusers 中找出 SID
注意:SQL Server 2000 所以不能使用 CREATE LOGIN 或 CREATE USER
Create the login and users, but find out the SID from sysusers
Note: SQL Server 2000 so can't use CREATE LOGIN or CREATE USER
好的,找到了答案 - 对象所有者必须更改为 DBO,无需在 SQL 脚本/查询中添加对对象的引用前缀 - 本例中的对象是数据库表
这是一个将更改的脚本数据库中对象的所有者(不是我自己的代码)
Ok, found the answer - the OBJECT owner must be changed to DBO, negating the need to prefix references to your object in your SQL scripts/queries - the object in this case being the database table(s)
Here is a script that will change the owner for objects within a database (not my own code)