SQL SERVER – Find All Servers From Local Network – Using sqlcmd – Detect Installed SQL Server on Network

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”.

SQL SERVER - Find All Servers From Local Network - Using sqlcmd - Detect Installed SQL Server on Network sqlcmdl

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)

SQL Function, SQL Scripts, SQL Utility, sqlcmd
Previous Post
SQL SERVER – Practical SQL Server XML: Part One – Query Plan Cache and Cost of Operations in the Cache
Next Post
SQLAuthority News – 900th Article – 9 Best Practices – Important Milestones

Related Posts

Leave a Reply