SansSQL

Saturday, May 3, 2008

Virtual LOG info

DBCC LOGINFO
It is used to get the number of virtual log file for a database.

How to get current database name

Use the below Query

SELECT db_name()

How to Change the Owner of a DTS package?

USE MSDB
sp_reassign_dtspackageowner [@name =] 'name', [@id =] 'id', [@newloginname =] 'newloginname'

sp_reassign_dtspackageowner is an undocumented stored procedure which is present in MSDB database.

Get the List of Failed Jobs

use msdb
SELECT name FROM msdb.dbo.sysjobs A, msdb.dbo.sysjobservers B WHERE A.job_id = B.job_id AND B.last_run_outcome = 0

How to get the version of SQL server

Simply execute the below query to get the SQL server version you are running.

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

Ads