Tuesday, March 20, 2012

Pulling SQL Server information in C#

I'm looking to pull information such as uptime, ip, status, db name, etc from my sql server database to display on a form. I'd like to get more detailed if I could, such as current load on database, threads, etc. Does anyone know if this is possible using C#?Hi Chris,
Most of these are retrieved via the @.@. variables. For a full list look in
BOL
Select @.@.CPU_BUSY
You may also want to look at sp_monitor
sp_monitor
I hope this helps
--
Greg O
Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
Document all your databases now.
http://www.ag-software.com/ags_scribe_index.aspx
Crosstab queries from SQL Server.
http://www.ag-software.com/xp_ags_crosstab.aspx
Edit Extended Properties as easy as can be.
http://www.ag-software.com/ags_SSEPE_index.aspx
"Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> I'm looking to pull information such as uptime, ip, status, db name, etc
from my sql server database to display on a form. I'd like to get more
detailed if I could, such as current load on database, threads, etc. Does
anyone know if this is possible using C#?|||Just to add - of course you can catch this info in C#. Stored procedures
give you rowsets and you can use DataReader to catch it; scalar values can
be caught as output parameters of the Command object.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
message news:uMFMbRyKEHA.2576@.TK2MSFTNGP12.phx.gbl...
> Hi Chris,
> Most of these are retrieved via the @.@. variables. For a full list look in
> BOL
> Select @.@.CPU_BUSY
> You may also want to look at sp_monitor
> sp_monitor
>
> --
> I hope this helps
> --
> Greg O
> Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
> Document all your databases now.
> http://www.ag-software.com/ags_scribe_index.aspx
> Crosstab queries from SQL Server.
> http://www.ag-software.com/xp_ags_crosstab.aspx
> Edit Extended Properties as easy as can be.
> http://www.ag-software.com/ags_SSEPE_index.aspx
>
> "Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
> news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> > I'm looking to pull information such as uptime, ip, status, db name, etc
> from my sql server database to display on a form. I'd like to get more
> detailed if I could, such as current load on database, threads, etc. Does
> anyone know if this is possible using C#?
>

No comments:

Post a Comment