dbTalk Databases Forums  

How to find Sql Server properties programatically

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss How to find Sql Server properties programatically in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Verve
 
Posts: n/a

Default How to find Sql Server properties programatically - 08-24-2005 , 03:26 AM






I am writing a program in .Net to retrieve properties of Sql Server.
How can I find the following properties without querying the database:

1. Replication enabled
2. Default language
3. Processors and threads running.

Thanks,
verve


Reply With Quote
  #2  
Old   
Simon Hayes
 
Posts: n/a

Default Re: How to find Sql Server properties programatically - 08-24-2005 , 04:14 AM






You're probably looking for SQLDMO, which is a COM interface to MSSQL -
see Books Online for the details.

1. You can use the SQLDMO Replication object to enumerate replicated
databases, individual publications and articles etc.

2. Use the SQLServer.Language property

3. I'm not sure exactly what you want, but WMI might be a better option
for hardware and OS information. If by "threads" you really mean SQL
Server processes, then you can use the SQLServer.EnumProcesses method

In many cases, SQLDMO executes TSQL commands behind the scenes, so you
still need an authenticated connection to the server (and possibly a
user mapping in individual databases) to use it.

Simon


Reply With Quote
  #3  
Old   
Verve
 
Posts: n/a

Default Re: How to find Sql Server properties programatically - 08-24-2005 , 04:19 AM



Hi,
Thanks for the prompt reply but can also tell me which classes I should
be querying in WMI or which interface?

Thanks in advance
Verve


Reply With Quote
  #4  
Old   
Simon Hayes
 
Posts: n/a

Default Re: How to find Sql Server properties programatically - 08-24-2005 , 04:28 AM



The full WMI reference is on MSDN, but the TechNet scripting library
might be a faster way to get started:

http://www.microsoft.com/technet/scr.../hwbavb03.mspx
http://www.microsoft.com/technet/scr.../pcthvb07.mspx

Simon


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.