0

I am trying to do some local development on various toy projects for learning purposes. I have Microsoft SQL Server Management Studio 2008 R2 (10.50.1617.0) and Visual Studio Express 2013 for Web installed on my machine. Projects using things such as Membership and Entity Framework code-first approach are failing to create databases. SSMS is configured to make connections to an external server with a bunch of my company's DBs on it, but I cannot connect to the local machine's SQL Server instance, which might be because it doesn't exist.

There is definitely no MSSQLSERVER service listed in the services list, which I assumed meant no instance of SQL Server was installed locally (even though I assumed VS 2013 or SSMS would have installed MSSQLSERVER?). This led me to download a copy of SQL Server 2012 Express LocalDB, but when I tried to install it, it failed, giving the following error:

Installation of SQL Server 2012 Express LocalDB failed because a higher version already exists on the machine. To proceed, uninstall the higher version and then run SQL Server 2012 Express LocalDB Setup again.

So I guess my question is, do I really have SQL Server installed? If so, how do I start the service (which is not even appearing in the services list) so that I can connect to it locally?

bubbleking
  • 3,329
  • 3
  • 29
  • 49
  • 2
    I believe you can get this error message even if you only have higher version *tools* installed, as well as with just eg. Visual Studio extensions. It's incredibly annoying :/ – Luaan Feb 12 '14 at 16:11
  • @Luann - Interesting. Any idea how to get some type of local SQL Server running, despite this? – bubbleking Feb 12 '14 at 16:16
  • I'm actually struggling with installing MS SQL 2012 after Visual Studio 2013 myself. I'm seriously considering uninstalling Visual Studio and all the other things related to MS SQL and trying to install the SQL server first. I've actually managed to upgrade the server, but now I can't update the management tools, aaaaargh. – Luaan Feb 12 '14 at 16:23

2 Answers2

4

If SQLExpress LocalDB is already installed (and it sounds like it is) all you need to do is supply an appropriate connection string:

Fx: "Server=(LocalDB)\v11.0; Integrated Security=True;"

For other variations and a discussion of the subject check What is the connection string for localdb for version 11

Personally I would uninstall any old SQL Server product editions, then any new ones, and ultimately re-install SQL Server 2012 from this URL: http://www.microsoft.com/en-us/download/details.aspx?id=29062

This will ensure you have an up to date development environment, 2008 R2 is pretty dated and it sounds like you have some side-by-side installation of SQL2k12 and SQL2k8 components, seems a little dirty. The SQL Server 2012 Express download page will offer you access to the latest versions of SSMS, x64 editions as well as "full" editions (e.g. full-text search, SSIS, etc.)

Most people install 2008 editions because they don't know how to locate SQL Server 2012 Express, which is a little strange. Probably due to Web PI not being updated for so long.

Community
  • 1
  • 1
Shaun Wilson
  • 8,727
  • 3
  • 50
  • 48
  • Thanks. I'm on a work machine that I was hesitant to mess with, but now I see there are many versions of SQL Server on here. I don't know how many people used this box before it got to me, but it appears to be quite a few. Our production tools are remote anyway, so I can probably get by with removing everything, installing SQL Server 2012 Express and SSMS. I've spent 2 days debugging strange connection errors in order to get a simple tutorial working. One error wouldn't let me create a table because "SQL Server 7 doesn't support FileStream" or something crazy like that. Yuck. – bubbleking Feb 13 '14 at 19:27
2

Install Sql Server Express (free) edition (where the sql-server-express version matches your SSMS version).

http://www.microsoft.com/en-us/download/details.aspx?id=25174

I name my "instance" something besides "Express" or "SqlExpress" to avoid future complications.

MyComputerName\SqlExpress2008R2

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • I updated the link to match my "special" instance name. – granadaCoder Feb 12 '14 at 16:26
  • You don't actually need matching versions of SQL Server (any edition) and SSMS (any edition since 2000) since the underlying TDS protocol is backward/forward compatible. Thus, you can access localdb installations of any version from SSMS 2008. I would uninstall all of these old tools/services and install the latest edition from Microsoft, including tools and services, this should clean up any non-standard names and provide clean defaults IDE tools can rely on. Named instances like this only further complicate the an environment. – Shaun Wilson Feb 12 '14 at 23:48
  • @Shaun. I mostly agree. One caveat. SSMS 2012 does not work with SqlserverCE. Thus one reason I had to install SSMS 2008 (to occasionally talk to SqlServerCE). – granadaCoder Feb 12 '14 at 23:52
  • Yeah it's a shame. I hope they put it to bed or do a better job in a future version. I believe you can connect to a CE database from Visual Studio 2010+ or WebMatrix.. but that may be a little heavy-handed if you're not already using either of those tools, there is also SQl CE Toolbox (http://sqlcetoolbox.codeplex.com/) you might find useful as a CE developer. – Shaun Wilson Feb 13 '14 at 21:23
  • I had high hopes for CE myself, while working at "a past job" we did *extensive* testing and performance profiling (since we had services that had to handle 8k-40k requests/sec). It turned out to be unstable, was not thread-safe and it under-performed (did not scale up) vs. alternative solutions. We ultimately went with Perst (which offers 'JSQL' syntax) and BDB (depending on actual use-case.) Since we could scale those solutions up without limitation, and they never crashed our services like CE would. – Shaun Wilson Feb 13 '14 at 21:25