dcode25 on Sat, 15 Aug 2015 17:54:29
I have an application in C# and SQL server . Using SMO , how can I get these information :
1) IF sql server is installed or no ( in a given PC name or Network path )
2) IF SQL server is running or no ( in a given PC name or Network path )
3) If is a SQL server or a SQL server Express
4) If Sql server is installed with a default instance or has a named instance.
5) Get the Instance name ( if is a named instance )
6) If a database exist or no in a sql server
Thank you !
HoroChan on Mon, 17 Aug 2015 02:34:36
See this link.
Olaf Helper on Mon, 17 Aug 2015 08:11:26
See Create Inventory of SQL Server in Network as Html; works in C# the same way.
dcode25 on Mon, 17 Aug 2015 10:16:35
Thank you !
But in your link I can see only how to detect if sql server 2005 is express or no.
does this works with other versions , and what about other questions ?
Olaf Helper on Mon, 17 Aug 2015 10:39:05
You can use SERVERPROPERTY (Transact-SQL) with Parameter "Edition" to query the edition Information, but for this you have to connect first. And with view "sys.databases" you can query existing databases.
dcode25 on Mon, 17 Aug 2015 11:50:47
Sorry , friends !
But I think I've made this question to SMO forum. So I'm looking for a solution for my questions that use SMO.