user2413912
user2413912

Reputation: 599

Connect to SQL instance to get version with C#

I have to check if an SQL Server is installed on random computers (running code locally) and connect to the instance and find the version of the SQL Server. Is this possible without having logins?

I've been told not to use the registry to look for the information and instead been suggested a couple of methods that both require connection with the instance. This of course will require the SQL Server to be running.

For extra info, I need to run either @@version or SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

I'd assume I need to at least use Windows Authentication, but will that be possible? These are computers that run in a production environment and I have "no control" over them (except that I can run my code on everyone of them).

Upvotes: 0

Views: 110

Answers (1)

Jocke
Jocke

Reputation: 2284

If you want to ask the SQL Server instance a question you need to connect to it! And in order to do that you need a valid (Windows Authentication or SQL Server Authentication) connection-string - so someone needs to provider you with that!

Upvotes: 1

Related Questions