Search This Blog

Wednesday, December 15, 2010

Microsoft® SQL Server® code-named 'Denali' - Community Technology Preview 1 (CTP1)

Overview


SQL Server code-named 'Denali' helps empowers organizations to be more agile in today’s competitive market. Customers will more efficiently deliver mission-critical solutions through a highly scalable and available platform. Industry-leading tools help developers quickly build innovative applications while data integration and management tools help deliver credible data reliably to the right users and extended managed self-service BI capabilities enable meaningful insights.

With SQL Server code-named 'Denali' customers will benefit from the following added investments:
  • Enhanced mission-critical platform: A highly available and scalable platform designed to with greater flexibility, lower TCO, ease of use, and the performance required by the most mission-critical applications.
  • Developer and IT Productivity: New additional tools will help developers build innovative applications with reduced time-to-market while IT professionals benefit from greater operational control and ease of use.
  • Pervasive Insight: Stunning new managed self-service experiences for end users and holistic data integration and management tools will help deliver consistent, credible data to the right users at the right time.
Click Title (to reach to download files and further reading...)

Tuesday, December 14, 2010

Monitoring Transactional Replication Status - SQL Server 2005, 2008, 2008 R2

USE DISTRIBUTION
GO
SELECT
      s.agent_id
      ,a.id
      ,s.article_id
      ,a.subscriber_id
      ,ar.Source_owner
      ,ar.Source_object
      ,ar.destination_owner
      ,ar.destination_object
      ,s.undelivcmdsindistdb
      ,a.publisher_db
      ,a.subscriber_db
      ,a.publication
FROM distribution.dbo.msdistribution_status s with (nolock)
INNER JOIN (SELECT * FROM msdistribution_agents with (nolock)) AS a ON a.id = s.agent_id
INNER JOIN (SELECT * FROM msarticles with (nolock)) AS ar
            ON ar.article_id = s.article_id
                  AND a.publisher_Db = ar.publisher_db
WHERE a.subscriber_db<>'virtual'
AND s.undelivcmdsindistdb>0
ORDER BY  s.undelivcmdsindistdb DESC

Monday, November 1, 2010

DDL EVENTS List - SQL Server 2008/R2

Below are the all events with their hierarchy and scope that you can use to implement DDL triggers at both Server or Database Level.
You can create trigger to fire on all events defined under a group, then you can create trigger for that particular group like "DDL_TABLE_EVENTS", this trigger will fire on all three sub-events defined under this group; these are CREATE_TABLE, ALTER_TABLE and DROP_TABLE. Similarly if you want to have a trigger to fire only for a particular event in an event group, then specify only that particular event like "ALTER_TABLE".
See example below as well:




Example 01: Database Level Trigger for a particular event
-- DDL Trigger to prevent column changes on a Database
CREATE TRIGGER ColumnChanges
ON DATABASE
FOR ALTER_TABLE
AS
BEGIN
-- Detect whether a column was created/altered/dropped.
SELECT EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]', 'nvarchar(max)')
RAISERROR ('Table schema cannot be modified in this database.', 16, 1);
ROLLBACK;
END
GO


Example 02: Server Level Trigger for a particular event
-- DDL Trigger to prevent column changes for all databases on an instance
CREATE TRIGGER ColumnChanges
ON ALL SERVER
FOR ALTER_TABLE
AS
BEGIN
-- Detect whether a column was created/altered/dropped.
SELECT EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]', 'nvarchar(max)')
RAISERROR ('Table schema cannot be modified in this database.', 16, 1);
ROLLBACK;
END
GO