0

I installed SQL Server but I forgot my server name and now that I install SQL Server Management Studio, it needs the server name.

How can I get server name again?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
tomos
  • 1
  • 1
  • 1
  • 1
  • Possible duplicate of [How to find server name of SQL Server Management Studio](https://stackoverflow.com/questions/16088151/how-to-find-server-name-of-sql-server-management-studio) – TT. Aug 31 '18 at 08:47

3 Answers3

3

You can get your server name with Transact-SQL(T-SQL) as shown below:

SELECT @@SERVERNAME                    -- DESKTOP-OVPADTC\SQLEXPRESS
SELECT SERVERPROPERTY ('ServerName')   -- DESKTOP-OVPADTC\SQLEXPRESS
Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
1

If you installed SQL Server on your local machine, you can get to the installed server using

.
(local)
localhost
YourMachineName

as the server/instance name.

If you installed SQL Server Express with the defaults, you can reach your instance with:

.\SQLEXPRESS
(local)\SQLEXPRESS
localhost\SQLEXPRESS
YourMachineName\SQLEXPRESS

Otherwise, you need to go to Start Menu > SQL Server > Configuration Tools > SQL Server Configuration Manager and see which SQL Server services are running:

enter image description here

If you find a Service Type = SQL Server with a State = Running, the instance name is provided in the brackets behind the "SQL Server" in the Name column - here it is SQL2014. In that case, you can connect to this running SQL Server instance on your local machine using:

.\SQL2014
(local)\SQL2014
localhost\SQL2014
YourMachineName\SQL2014

If the instance name (in brackets) is MSSQLSERVER, this means it's the default, unnamed instance - and you can connect to it with just one of the first four options - just the "local machine server name" - no instance needs to be provided.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
0

When the ssms's launched, the "Connect to Server" appears first,

then in the Server name field it'll have already selected (probably your pc name if you gave default on server installation) the server name.

If it isn't there, then click on it (Server name drop down)
<Browse for more...>
then on the popup "Browse for Servers"
click on "Database Engine"
and you can find your server name there.
There will be only one server name there ,if this is the first server you've created.
Click on the server name and hit OK!

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Shady
  • 96
  • 1
  • 9