sorry, i wanted to find the number of SQL server 2008 on windows 2003.. but your command will give all the windows server, any wayOriginally Posted by Raikkonen
if you type in OSQL -L would give you the list, but if you want to complicate things, like i alwys do the following SQL script will do
/* Gives a list SQL servers on a given domain */
CREATE PROCEDURE dbo.ListLocalServers
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers EXEC master..XP_CMDShell 'OSQL -L'
-- play with ISQL -L too, results differ slightly
DELETE #servers WHERE sname='Servers:'
SELECT LTRIM(sname) FROM #servers WHERE sname != 'NULL'
DROP TABLE #servers
END
exec ListLocalServers
Bookmarks