Cannot be opened because it is version 852. this server supports version 782 and earlier

前端 未结 5 470
旧时难觅i
旧时难觅i 2020-12-03 15:23

I am using Visual Studio 2017 and SQL Server 2014. While attaching a database file to Visual Studio, I get this error:

\"\"

After upgrading the file I used t

5条回答
  •  萌比男神i
    2020-12-03 15:58

    It seems you have multiple instances of various versions of SQL Server on your machine.

    For the "full-blown" versions (Express and up), you can check what version they are by looking at the SQL Server Configuration Manager:

    For the "LocalDB" versions of SQL Server (developer-oriented versions), you can use the sqllocaldb command line tool.

    Get an overview of what you have on your machine using this command:

    C:\> sqllocaldb i
    
    MSSQLLocalDB
    v11.0
    

    Then, you can check the individual instances using the details command:

    C:\> sqllocaldb i mssqllocaldb
    
    Name:               mssqllocaldb
    Version:            13.1.4206.0
    Shared name:
    Owner:              MSE-PC-02\Marc
    Auto-create:        Yes
    State:              Stopped
    Last start time:    27.08.2017 12:24:45
    Instance pipe name:
    
    
    C:\> sqllocaldb i v11.0
    Name:               v11.0
    Version:            11.0.3000.0
    Shared name:
    Owner:              MSE-PC-02\Marc
    Auto-create:        Yes
    State:              Stopped
    Last start time:    26.08.2017 15:41:18
    Instance pipe name:
    

    So this tells you that there are two instances of SQL Server LocalDB available - mssqllocaldb is version 13.1 (SQL Server 2016), while the v11.0 instance is version 11.0 (SQL Server 2012).

    So if you want to attach a .mdf file to any one of those two instances, you just need to pick the right one in order to get it working with the version you want. And once you've "upgraded" a database file to a newer version of SQL Server (like 2016 - internal DB version 852), you can NEVER go back - there's no way to detach/attach, backup/restore or other ways to get those binary files to an older version of SQL Server. You would have to script out the structure (and possibly data) of your newer database file to .sql files and run those on the older version.

提交回复
热议问题