Skip to main content
4 of 5
added 1965 characters in body
IT researcher
  • 3.1k
  • 15
  • 57
  • 82

Attaching a database in SSMS without sysadmin role gives error

I am accessing my sql server 2008 r2 express server using SSMS. I have a user which has got db_owner permission for all database and all permissions in server role other than sysadmin. When this user tries to attach a database by using ssms(by right clicking on database node and then clicking on attach) the error message comes like

Cannot show requested dialog.

------------------------------
ADDITIONAL INFORMATION:


Parameter name: nColIndex
Actual value was -1. (Microsoft.SqlServer.GridControl)

------------------------------

Program Location:



 at Microsoft.SqlServer.Management.UI.Grid.GridControl.SetColumnWidthInternal(Int32 nColIndex, GridColumnWidthType widthType, Int32 nWidth)
at Microsoft.SqlServer.Management.UI.Grid.GridControl.SetColumnWidthInternalForPublic(Int32 nColIndex, GridColumnWidthType widthType, Int32 nWidth)
 at Microsoft.SqlServer.Management.UI.Grid.GridControl.SetColumnWidth(Int32 nColIndex, GridColumnWidthType widthType, Int32 nWidth)
 at 

Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SetGridColumnWidth(SqlManagerUIDlgGrid grid, Double[] columnWidthRatio, Int32 columnIndex)
   at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SetDatabasesGridColumnWidths()
   at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.OnScale()
   at Microsoft.SqlServer.Management.SqlMgmt.SqlManagementUserControl.ScaleToFont()
   at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.DynamicallyEmbedUserControl(ViewInfo vi, TreeNode node)
   at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SetView(Int32 index, TreeNode node)
   at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SelectCurrentNode()
   at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.InitializeUI(ViewSwitcherTreeView treeView, ISqlControlCollection viewsHolder, Panel rightPane)
   at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument doc, IServiceProvider provider, ISqlControlCollection control)
   at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(XmlDocument doc, IServiceProvider provider)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolMenuItemHelper.OnCreateAndShowForm(IServiceProvider sp, XmlDocument doc)
   at Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()

If the same user uses t-sql command such as below to attach database then it works fine.

USE [master]
GO
CREATE DATABASE [hgnx] ON 
( FILENAME = N'E:\db\hgnx.mdf' ),
( FILENAME = N'E:\db\hgnx_log.ldf' )
FOR ATTACH
GO

So what is the error causing me while attaching database in SSMS? How to solve it?

IT researcher
  • 3.1k
  • 15
  • 57
  • 82