What’s the best method to check if SQL server exists or not?
I’m trying Microsoft.SqlServer.Management.Smo.Server.PingSqlServerVersion()
and it works fine if server exists and available.
But it kinda pretty slow, if there is no such a server.
Is there any fast enough method to check without even defining user credentials (only the server name), if a server exists?
What do you recommend to use?
You could just use TcpClient class to query the server and check if a specific port is open, could be something like this: