I recently had requirement to create list of all the SQL Server on local network. I remembered that I had written similar script a year ago SQL SERVER – Script to Find SQL Server on Network. When I looked at it, I realize that I had written it for SQL Server 2000 and used “isql” utility, which is deprecated now. I quickly wrote down updated script using “sqlcmd”. Command “osql” still works in SQL Server 2008.
Go to command prompt and type in “osql -L” or “sqlcmd -L”.
Note one change between osql and sqlcmd is that osql has additional server “(local)” listed in the servers list which is in fact same as “SQL” in my case. While “sqlcmd” gives accurate result.
Reference : Pinal Dave (https://blog.sqlauthority.com)
87 Comments. Leave new
hey Pinal,
Am trying to see all the databases on a local network. Both that send instance or does not send instance? Can u help me?
thanks in advance
Thankz a lot..:D
Hi Pinal,
I am trying to connect one of the remote database from my .Net application, but i am not able to connect as i am getting the following error.
——————————-
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessbile. Verify that the instance name is correct and that the SQL Server is configured to allow remote connections. (provided: Named Pipes Provider, error: 40- Could not open a connection to the SQL Server)
——————————-
I am having both SQL Server 2005/2008 as well on my system.
I would be really grateful if you can help me on this.
Thanks in advance.
Rgds
Prakash
Make sure the application is using the correct connectstring and the server is available over network
VERY THANKS
I installed SQL Express 2005 on my laptop, I want to use as my database engine for a small business. I have this error (53)…,and SQL browser is stopped, each time I start it, it will give error…what can i do…?
can share your net thou SQL Server 2005/2008 with out my say so .. or can some 1 hack ur network thou cable network .. like know how stop People gain access too your pc .. stop how stop People .. used my net though wireless connection’s
i ve unstalled SQL Server 2005 from my pc . becase think some try used get accesss too my pc .
i need simlpe way’s understanding what is SQL Server 2005 act do ..i am not pc tech .. please some 1 till what do here protect my salf some time do think fire wall do it’s job
hop some can help me this isssue be great ta ..
from proline .
dear sir, i executed the command sqlcmd -L in the prompt and i found the output as :
A-9
A-9\NEW
A-9\SQLEXPRESS
But i have created an instance MSSQLSERVER with windows authentication but this is not shown in the above output, also in visual studio when i want to connect to this instance through data source MS Sql Server then it does not shows this instance name in the list
Can you check if it comes under your system’s network?
When I run the “sqlcmd -L” on the CommandPrompt, it only outputs..
Server :
..and nothing more, what does it mean?
sir can u tel me how to set the following in object explorer ( ms sql 2005)
server type:
server name:
authentication:
login name:
password:
plz explain how to set these………..
Hello Pinal,
Is there any way that I can get all the servers list in our network with version of sql server?
This is really important for us to know, how many servers are in our network with version.
In the command prompt use, osql -L
hi, i run the command….but i found that i don’t have one in the list. my sever is the domain controller. and i can not access to it. can i add the local server to the list?
thank you
Hello Sir,
i am having problem ,
I can’t access my Network SQL Instance ,
i enabled SQL SERVER BROWSER ,
i can access my Instance on same system , am using LAN and trying to search for instance so it is not showing……
PlzZz help…..me
ThanxXx in Advance
Hey guys, has anyone tried the following SQL command out? It lists servers and let’s you select which one to attach.
DROP *
Hello,
Thank you for every body:)
i have problme that i do all command you presented such as
sqlcmd -L and osql -L
but i don’t see and servers.
also when i go to sql server managment stiduo
i can’t login because there is no server
note i have installed
sql server 2008 SQLManagementStudio_x86_ENU.
please could you check my status
Regards,
Hi Sir,
Please help me. I can’t attach MS SQL to my Visual Studio 2005/2008/2010. The Visual Basic can’t find the SQL Database. either I can’t find the SQL database to my savepoint even thoe my Laptop is newly reformatted.. help me please, asoon as posible..
God bless..
Mr.JC
We have few servers in remote location and couple of in house servers
everything is in same domain but when i run SQLCMD -L command on server at remote location i see only servers of remote location,,,, and when i run the same command on any of the inhouse servers it gives list of all inhouse servers, why is it so despite i have everything in same domain
You had mentioned to, “Run “sqlcmd -L” in your command prompt to ascertain if your server is included in your network list.” My server is not in that list, so how do I add it to it? I am using Windows Server 2003.
Thanks BC
sqlcmd -L does not give the complete list. However osql -L gives.
Tayfun Demirbilek
I am a student and i want to use SQL SERVER 2005 for basic use and when i will opened SQL SERVER STUDIO 2005 its ask server name but i have not any server then how can i use it ?
no server at all
Server :
only