Category Archives: SQL Server 2012

Script to get the SQL Agent Properties

You can use the sp_get_sqlagent_properties undocumented stored procedure to retrieve the SQL Agent properties of a SQL Instance. It is available in SQL Server MSDB database. This procedure only works if the SQL Agetn Service is started.

SQLAgent

Steps to Move SQL Server Log Shipping Secondary Database Files

Problem
With SQL Server is it possible to move the secondary database involved with Log Shipping to a different drive without disturbing the Log Shipping configuration? If so, what are the steps to accomplish this task? Check out this tip to learn more.

Solution
http://www.mssqltips.com/sqlservertip/2836/steps-to-move-sql-server-log-shipping-secondary-database-files/

sys.dm_server_services

sys.dm_server_services DMV is available in SQL Server 2008 R2 SP1 and SQL Server 2012. It will return the information about the below SQL Services on the current instance.

  • SQL Server (2008 R2 SP1 and SQL Server 2012)
  • SQL Server Agent services(2008 R2 SP1 and SQL Server 2012)
  • Full-Text(SQL Server 2012)

PS

Logical function – Choose – SQL Server 2012

CHOOSE function is the logical function. It is similar to SWITCH function in .NET. Choose function will return the item at the specified index from the list of values .

-- below query will return "SQLDBPool-2"as output
Select CHOOSE(2,'SQLDBPool','SQLDBPool-2','SQLDBPool-3')

-- below query will return "Thursday"as output
DECLARE @day as int
set @day = 5
SELECT Choose(@day,'Sunday','Monday', 'Tuesday', 'Wednesday','Thursday','Friday','Saturday')