Showing posts with label checking. Show all posts
Showing posts with label checking. Show all posts

Wednesday, March 7, 2012

Programmatically checking whether Integration service is running or not

I am building an application that uses .NET 2.0 transaction feature. Since .NET 2.0 transaction model uses SQL Server 2005 Integration services for its operation, I want to check from my application (.NET 2.0 code) whether the Integration service is running on SQL box or not? Is there a way in which we can accomplish this task?

Prashant

You can query the SSIS service with the GetRunningPackages method to get the packages running on a server.

http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.application.getrunningpackages.aspx
|||Using GetRunningPackages is perhaps not quite the same as saying is the windows service running, which seemed to be the original question. The fact that the service supports that method would probably allow you to infer that result, but maybe you would want to find out more about the service or control it, in which case have a look at the System.ServiceProcess.ServiceController class. The System.ServiceProcess namespace contains classes for manging Windows Services, not anything specific to SSIS.

Programmatically checking the database compatibility level?

When my app starts up I want to ensure that the database compatibility level has been set to 90. I know about sp_dbcmptlevel, but that only seems to work in an interactive session; the documentation says it can't be used in a stored procedure, and that appears to be true. Does anyone know how I could read the database compatibility level in a stored proc?

You can query the catalog views below to get the database compatibility level information:

-- SQL Server 2005 only

select compatibility_level from sys.databases where name = @.dbname

-- SQL70/2000/2005
select cmptlevel from master.dbo.sysdatabases where name = @.dbname

|||That's it. Thanks!