Logic behind data source=(local) in connection string

10,898

Solution 1

Using "local" you get the default instance which is usually the non-express SQL Server since by default in SQL Server Express installation the instance name is "SQLEXPRESS" and in full SQL Server installation by default you don't get an instance name unless you set it explicitly.

Solution 2

(local) just means means to use the SQL Server installed in the current Machine
Any of the following three

  • "(local)" ,
  • "." ,
  • ".\\SQLEXPRESS"

can be used to make use of the SQL Server installed in the current Machine.

Share:
10,898
user1635311
Author by

user1635311

Updated on June 04, 2022

Comments

  • user1635311
    user1635311 almost 2 years

    I have two instances of SQL Server 2008 Express and one instance of SQL Server 2012 on my development machine. We're developing an ASP.NET MVC application and use the expression data source=(local); inside of our connectionString in Web.config.

    Now my question is what is the logic behind this expression? Which instance gets chosen and how can I change this behavior?