Thursday, December 18, 2014

Error Scripting database with only dbo rights

With only dbo permissions to a database, you will get this error when you try to script the database.

"Could not read metadata, possibly due to insufficient access rights. (Microsoft.SqlServer.Smo)"

Try this:
  1. From SSMS
  2. Right click on the server name and click properties
  3. Click on the Permissions tab
  4. Click the user name
  5. On the Explicit Permissions almost at the bottom there is "View Any Definition" grant that.
Reference:
http://www.sqlservercentral.com/Forums/Topic355850-149-1.aspx