Как найти сервер имя в sql

I installed Microsoft SQL Server 2008.

When I start SQL Server Management Studio (SSMS), I get the Connect to Server login window with a blank textbox for Server name. I have tried a lot of names, but I couldn’t solve it.

How can I find / get the server name?

Mwiza's user avatar

Mwiza

7,4903 gold badges44 silver badges40 bronze badges

asked Apr 18, 2013 at 16:18

Cantremember's user avatar

2

Open up SQL Server Configuration Manager (search for it in the Start menu). Click on SQL Server Services. The instance name of SQL Server is in parenthesis inline with SQL Server service. If it says MSSQLSERVER, then it’s the default instance. To connect to it in Management Studio, just type . (dot) OR (local) and click Connect. If the instance name is different, then use .[instance name] to connect to it (for example if the instance name is SQL2008, connect to .SQL2008).

Also make sure SQL Server and SQL Server Browser services are running, otherwise you won’t be able to connect.

Edit:

Here’s a screenshot of how it looks like on my machine. In this case, I have two instances installed: SQLExpress and SQL2008.

enter image description here

answered Apr 18, 2013 at 17:07

Arian Motamedi's user avatar

Arian MotamediArian Motamedi

7,03310 gold badges42 silver badges82 bronze badges

9

Run this Query to get the name

SELECT @@SERVERNAME

answered Sep 12, 2013 at 13:07

sansalk's user avatar

sansalksansalk

4,5352 gold badges35 silver badges35 bronze badges

5

Open cmd.exe (WINDOWS + R type cmd and press Enter)

and run this

SQLCMD -L

You will get list of SQL Server instance

3rd party edit

CMD.exe_with_SQLCMD_and_OSQL_Result

surfmuggle's user avatar

surfmuggle

5,3167 gold badges47 silver badges75 bronze badges

answered Nov 6, 2014 at 4:36

Khaneddy2013's user avatar

Khaneddy2013Khaneddy2013

1,2611 gold badge17 silver badges25 bronze badges

3

the default server name is your computer name, but you can use “.” (Dot) instead of local server name.

another thing you should consider is maybe you installed sql server express edition. in this case you must enter “.sqlexpress” as server name.

answered Apr 18, 2013 at 16:37

Ali's user avatar

AliAli

7981 gold badge5 silver badges11 bronze badges

1

Note: To connect to server on SQL Server Management Studio(SSMS), we must first install SQL Server.

So steps to proceed are as

Step 1 : Downloads and Install Microsoft SQL Server 2019

Step 2 : Downloads and Install SQL Server Management Studio

If still not able to see the Server name on SSMS, have a look at these three screen:

enter image description here
enter image description here
enter image description here

answered Oct 17, 2020 at 5:41

mabdullahse's user avatar

mabdullahsemabdullahse

3,26425 silver badges21 bronze badges

1

As mentioned by @Khaneddy2013, the cmd SQLCMD -L
returns no server name when I run. Bcz I only have installed the SSMS (local db and server were not installed).
After tried installing SqlLocaLDB and SQLEXPR32_x86_ENU(32 bit OS) I was able to connect. And now the cmd window shows the server names too.
enter image description here

answered Jun 23, 2017 at 19:27

SivaKtamilan's user avatar

2

There are many ways mentioned above. But I use rather simple way (well not simple as SELECT @@SERVERNAME). When you start SQL server management studio you will prompt below GUI

enter image description here

In there Server name is your server name (There may have multiple servers according to you dev environment choose correct one). Hope this helps 🙂

answered Aug 21, 2017 at 4:48

Menuka Ishan's user avatar

Menuka IshanMenuka Ishan

4,9642 gold badges50 silver badges65 bronze badges

1

start -> CMD -> (Write comand) SQLCMD -L first line is Server name if Server name is (local) Server name is : YourPcNameSQLEXPRESS

answered Feb 29, 2016 at 18:21

1

given the following examples

  • SQL Instance Name: MSSQLSERVER
  • Port: 1433
  • Hostname: MyKitchenPC
  • IPv4: 10.242.137.227
  • DNS Suffix: dir.svc.mykitchencompany.com

here are your possible servernames:

  • localhostMSSQLSERVER
  • localhost,1433MSSQLSERVER
  • MyKitchenPC,1433MSSQLSERVER
  • 10.242.137.227,1433MSSQLSERVER
  • MyKitchenPC.dir.svc.mykitchencompany.com,1433MSSQLSERVER

answered Oct 4, 2017 at 17:27

morethanyell's user avatar

1

Step1: Ensure SQLEXPRESS and LocalDB installed on your system
Go to SQL SERVER Configuration Manager => SQL Server Service

If nothing listed for SQL Server services, install below components (for 64 bit OS)
1. SqlLocalDB
2. SQLEXPR_x64_ENU
3. SQLEXPRADV_x64_ENU
4. SQLEXPRWT_x64_ENU

Step2: Open Management Studios
Enter . (Dot) as server name and click on Connect
[enter image description here][2]
Else
Enter .SQLEXPRESS as server name and click on connect

answered Oct 27, 2015 at 5:51

MV Sreedhar's user avatar

MV SreedharMV Sreedhar

3392 silver badges7 bronze badges

0

I also had this problem first time.

In the Connect to Server dialog box, verify the default settings, and then click Connect. To connect, the Server name box must contain the name of the computer where SQL Server is installed. If the Database Engine is a named instance, the Server name box should also contain the instance name in the format: computer_nameinstance_name.

So for example i solved the problem like this: I typed in the server name: Alex-PCSQLEXPRESS

Then it should work. for more see http://technet.microsoft.com/en-us/library/25ffaea6-0eee-4169-8dd0-1da417c28fc6

answered Dec 11, 2013 at 20:03

Akbar's user avatar

AkbarAkbar

611 silver badge3 bronze badges

Try using a . or localhost as server name, might work a few times.

answered Feb 14, 2022 at 15:57

Shravya Mutyapu's user avatar

simply type .sqlexpress as the Server Name

answered Oct 25, 2019 at 15:39

kiran's user avatar

kirankiran

463 bronze badges

Typing sp_helpserver will give you a list. As others have noted, there are multiple ways, some with alias’ and such. This stored proc may return multiple lines but could get you closer to your answer.

answered Nov 5, 2019 at 17:47

Grandizer's user avatar

GrandizerGrandizer

2,7594 gold badges45 silver badges72 bronze badges

1.you can run following command.

EXEC xp_cmdshell ‘reg query “HKLMSoftwareMicrosoftMicrosoft SQL ServerInstance NamesSQL”‘;
GO

you can read instance name using Registry. Ingore null values.

2.using inbuilt standard Report.

select instance–> right click->Reports–>Standard Reports–>server Dashbords enter image description here

answered Dec 30, 2016 at 11:12

Vishe's user avatar

VisheVishe

3,3331 gold badge24 silver badges23 bronze badges

1

Please Install SQL Server Data Tools from link (SSDT)

You can also Install it when you are installing Visual Studio there is Option “Data Storage and Processing” you must be select while installing Visual Studio

enter image description here

Minal Chauhan's user avatar

answered Apr 3, 2019 at 10:27

Sanjay Dwivedi's user avatar

On installing the sql server 2019 management studio the default server name will be : localhostSQLEXPRESS
default connection string is :
Server=localhostSQLEXPRESS;Database=master;Trusted_Connection=True;

answered Jul 1, 2022 at 15:17

Anindya's user avatar

AnindyaAnindya

2,5962 gold badges21 silver badges25 bronze badges

my problem was that when connecting to SQL Database in the add reference wizard, to find the SERVERNAME. i found it by: running a query(SELECT @@SERVERNAME) inside SQL management studio and the reusl was my servername. I put that in my server name box and it worked all fine.

answered Jul 22, 2015 at 9:05

user5142746's user avatar

1

Для выполнения запросов к локальной базе данных Microsoft SQL Server из программы необходимо знать имя экземпляра сервера. Из статьи вы узнаете, как его получить.

Способ первый. Самый надежный

В Microsoft SQL Server предусмотрен специальный SQL запрос, возвращающий имя экземпляра сервера:

Выполнив данный запрос, например, в SQL Server Management Studio, вы получите имя вашего экземпляра сервера.

Как узнать имя сервера Microsoft SQL Server с помощью SQL-запроса

В данном случае было возвращено имя установленного экземпляра Microsoft SQL Server равное: SQLEXPRESS.

Способ второй

Другим способом получения имени SQL-сервера является поиск записи службы SQL Server.

Запустите классическое приложение Windows «Службы» на вашем компьютере и найдите в списке служб объект SQL Server.

В скобках будет указано имя экземпляра.

Как узнать имя сервера Microsoft SQL Server - c помощью имени службы Windows

В этом же меню можно остановить, запустить и перезапустить экземпляр установленного Microsoft SQL Server.

Стоит отметить, что второй способ получения имени сервера — менее достоверен. В скобках не всегда указано истинное имя сервера, пригодное для обращения к нему при подключении. Поэтому при наличии возможности лучше всего использовать первый способ получения имени с помощью SQL-запроса.

В современных версиях MS SQl кроме имени сервера есть еще понятие экземпляра SQL сервера. С учетом этого строка для подключения к MS SQL выглядит так:
<имя сервера><имя экземпляра>
Если экземпляра нет, а такое то же может быть, то его задавать не нужно.
На одном сервере может быть несколько экземпляров.
Имя экземпляра задается при установке MSSQL. Узнать его можно:
1.зайдя в настройки Служб Windows найдите там службу SQL Server в скобках будет указано имя экземпляр. Таких служб может быть несколько по одной на каждый экземпляр.
2.Зайдите в панели управления в настройки ODBC подключений, добавьте пользовательское подключение, выберите тип для SQL Server и дальше в мастере на первой, по моему, странице нужно будет указать сервер, если нажать на выпадающий список в этом пункте в списке будут перечислены все доступные экземпляры MS SQL. Этот список формируется динамически опросом сети.
3.есть и другие способы, но думаю этих будет достаточно.

I was just given a laptop to perform some development from a client and I am currently in the process of setting it up. Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2. I’m trying to open SQL Server Management Studio to connect to the database but so far am not having much luck. I’m used typing in for a server name something like…

localhost
(local)
SQLEXPRESS

None of these are working.

So my question is: How can I tell what type of SQL Server installation and configuration I have on this machine, and how can I discover what server name I need to use in order to properly connect to it?

–Addition——————————————–

I looked into the services as directed and found a few instances as indicated. SQLEXPRESS and MSSQLSERVER. I have tried to login with both of those options in these configurations…

SQLEXPRESS
MSSQLSERVER
computernameSQLEXPRESS
computernameMSSQLSERVER
.SQLEXPRESS
.MSSQLSERVER

None of these worked. I also altered the ‘Log On As’ property of the services from ‘Network Service’ to ‘Local System’ and tried them again. Still no success.

There are multiple ways on getting the SQL Server instance name. You can refer any of below methods.

Below example were tested on SQL Server 2012 R2 version but the steps will be similar to other SQL Server versions.

Method 1

Launch the SQL Server Management Studio. You will get the Connect to Server dialog box. From here, you can obtain the instance name, which is at the Server name.

If it’s does not appear, click on Server name drill down list and click Browse for more. Once clicked, you will get below screen and you will get the instance name under the Database Engine.

Method 2

Use below query.

Method 3

Login to the SQL server operating system, open the command prompt and execute below command line.

Method 4

Open the SQL Server Configuration Manager, click on SQL Server Services and double click on SQL Server (MSSQLSERVER).

Go to Service tab and you will get the instance name from here, as per below screenshot.

Добавить комментарий