Unable to attach database using Management Studio RRS feed

  • Question


    Hi,  I have installed SQL Express 2008 on a Windows XP SP2 box. SQL Server 2005 is also on this box (installed as part of another program).


    When I try to attach a database using Management Studio I get the following error:



    Cannot show requested dialog.


    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()


    Can anyone offer some advice, please?



    Saturday, June 21, 2008 4:26 AM


All replies

  • Hello,


    First of all, i wish a good welcome on our Sql Server forums, as it's your first post.

    I hope you will enjoy them and especially you will find quickliy a solution to your problem.


    Please, could you tell us which version and edition of Sql Server 2008 have you installed ?

    - Express "normal", with advanced services

    - CTP,RC0 ? ( for the moment, you can only install pre-versions of Sql Server as the "official" version RTM will not be released before August )


    As you are using Sql Server Management Studio Express Edition ( SSMSEE ), could you answer to the same question for this product ?


    Please, could you tell us how have you created the database you are trying to attach ?


    If my memory is good, there are some "youth" problems when you

    - try to do some operations with SSMSEE  2005 on 2008 databases

    - idem when you are trying to use 2005 databases inside SSMSEE ( or SSMS ) 2008 


    We are waiting for your feedback to help you more efficiently


    Have a nice day


    Saturday, June 21, 2008 5:22 AM
  • Try the single file version of database attach. Here is a sample:

    Code Snippet
    USE master;
    EXEC sp_attach_single_file_db @dbname = 'AdventureWorks',     
    @physname = N'f:\data\AdventureWorks_Data.mdf';


    Kalman Toth SQL SERVER 2012 & BI TRAINING
    New Book: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2012

    • Edited by Kalman Toth Friday, September 28, 2012 11:17 PM
    Saturday, June 21, 2008 5:24 AM
  • Thanks so much for your prompt reply. SQLUSA's solution works a treat and I'll stick with using it for the time being.

    However, it doesn't actually address why I can't use the Add Database feature.  This doesn't matter right now.  I'll end up rebuilding this PC soon anyway and I suspect the problem will be fixed then.  I think SQL 2005, 2008, Express and Compact have been installed and uninstalled too many times and something has been corrupted in the process.

    But, for now, I'm happy to have a working solution.

    Saturday, June 21, 2008 8:30 AM
  • I am having this same error message.

    SQL express with advance services running on windows server 2008 RC1 trial edition running in a VM

    This message appers when I click the attach database menu command, so can not be related to the type of file I am trying to add.

    I am using
    Sql Server Management Studio Express Edition ( SSMSEE )

    Monday, June 23, 2008 3:43 PM
  • Hello,


    That's maybe clearer for me :


    - you are on windows server 2008 RC1  is it an definitive version ? ( i'm not sure... )

    - VM : ?


    windows server 2008 is not in the list of OS accepted for Sql Server Express 2005

    Windows 2000 Service Pack 4; Windows Server 2003 Service Pack 1; Windows Vista; Windows XP Service Pack 2


    I'm not sure that your problems are coming from that...

    I will search as i've seen something about it


    Have a nice day


    Monday, June 23, 2008 4:53 PM
  • Hello TTTTT,


    I hope you are not trying to attach a 2008 database file to a Sql Server 2005 ?


    Have a nice day



    Monday, June 23, 2008 5:30 PM
  • I am trying to attach a database using Microsoft SQL Server Management Studio.  The database is located in the program data folder and the browse option does not display this folder.  FYI: I have configured to show this hidden folder so, I assume, it should be displayed on the browse menu.


    I'm running SQL 2008 Express 64 bit.




    Wednesday, September 3, 2008 5:47 PM
  • I too got the


    TITLE: Microsoft SQL Server Management Studio

    Cannot show requested dialog.


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



    but I resolved it by logging on to the database using windows authentication. So I'm sure it's a security rights configuration management issue in the database system domain.


    [Running vista ultimate x64, with sql server 2008 express]

    Thursday, December 11, 2008 10:14 AM
  • Try check permission. Logon to Management Studio as sa user not builtin user
    Saturday, July 4, 2009 9:02 PM
  • Try check permission. Logon to Management Studio as sa user not builtin user

    Yup.  This did it for me.  As long as I log in as sa then I can do it and I don't get the errors noted above.  Thanks!
    Monday, April 12, 2010 8:51 PM
  • Try check permission. Logon to Management Studio as sa user not builtin user

    Yup.  This did it for me.  As long as I log in as sa then I can do it and I don't get the errors noted above.  Thanks!

    Does anyone know if there is a built in server role other than sa that allows attaching files.  I am experiencing the same behavior on an SQL Server 2008 DB engine instance running on Windows Server 2008R2.  When the SA attempts to attach the DB the dialog displays properly.  When I do it I get the same message listed by the original poster.  I am in the dbcreator, public, and setupadmin groups.  I am a consultant for this company and should not have sa privileges.  (I am obviously not a db admin consultant!!!)



    Larry West University of Central Florida
    Monday, November 22, 2010 5:57 PM
  • Hi all

    I think this problem has relation with premissions

    i had the same problem but i resolve it when i had add the login to the sysadmin role

    try to elevate the login permissions

    Sunday, March 6, 2011 1:57 PM
  • I had the same issue - but it was when I had detached my login's default database.   

    Managed to connect using the connect dialog's option of which DB to connect to but couldn't attach _or_ change permissions on the login (to change the default db)

    So I created a new blank DB with the same name as the original (CREATE DATABASE database_name), then I could login and change the default db / elevate permissions / attach DBs etc


    • Proposed as answer by Kalman Toth Thursday, November 22, 2012 1:24 PM
    Friday, October 7, 2011 8:52 AM
  • where do i type that in?

    Friday, August 3, 2012 5:53 AM
  • Your solutions it´s work!!!

    Beacause, to elevate the login permissions, also there is the possibility of deactivate the windows autentications to improved the security with the SQLsever manager 2008

    Thursday, November 22, 2012 1:07 PM
  • The SA account is disabled by default and it's not recommended to enable it.

    You have to open "SQL Server Management Studio" as an Administrator (right click in the Start menu and select "Run as administrator"). Login to the database using Windows Authentication and you should be able to attach a database.

    Thursday, March 3, 2016 11:04 AM