SQL SERVER – Script to Find SQL Server on Network

I manage lots of SQL Servers. Many times I forget how many server I have and what are their names. New servers are added frequently and old servers are replaced with powerful servers. I run following script to check if server is properly set up and announcing itself. This script requires execute permissions on XP_CMDShell.

CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers (sname)
EXEC master..xp_CMDShell 'ISQL -L'
DELETE
FROM
#servers
WHERE sname='Servers:'
OR sname IS NULL
SELECT LTRIM(sname)
FROM #servers
DROP TABLE #servers

Watch a 60 second video on this subject
[youtube=http://www.youtube.com/watch?v=8P5TuOg3PlA]

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Scripts, SQL Server Security, SQL Stored Procedure, SQL Utility
Previous Post
SQL SERVER – 2005 – Disable Triggers – Drop Triggers
Next Post
SQL SERVER – Stored Procedures Advantages and Best Advantage

Related Posts

Leave a Reply