Wednesday, January 30, 2008

SQL Server 2005 Logon Triggers

Every time a user connects to the database a trigger is fired. In the logon trigger you simple insert a row into an auditing table. Yuo can read about SQL Server 2005 Logon Triggers here.

Tuesday, January 29, 2008

What's New (SQL Server 2008)

Here you can read about new or improved features of Microsoft SQL Server 2008.

MERGE Statement in MS SQL Server 2008

MS SQL Server 2008 introduces new MERGE statement. You can perform INSERT, UPDATE, and DELETE operations in a single statement using MERGE. The MERGE syntax allows you to join a data source with a target table or view, and then perform multiple actions based on the results of that join.
You can read about new MERGE statement at MSDN Site.
Here are examples of MERGE from MSDN:
MERGE Production.ProductInventory AS pi
USING (SELECT ProductID, SUM(OrderQty) FROM Sales.SalesOrderDetail sod
JOIN Sales.SalesOrderHeader soh
ON sod.SalesOrderID = soh.SalesOrderID
AND soh.OrderDate = GETDATE()
GROUP BY ProductID) AS src (ProductID, OrderQty)
ON (pi.ProductID = src.ProductID)
WHEN MATCHED AND pi.Quantity - src.OrderQty = 0
THEN DELETE
WHEN MATCHED
THEN UPDATE SET pi.Quantity = pi.Quantity - src.OrderQty;
MERGE Departments AS d
USING Departments_delta AS dd
ON (d.DeptID = dd.DeptID)
WHEN MATCHED AND d.Manager <> dd.Manager OR d.DeptName <> dd.DeptName
THEN UPDATE SET d.Manager = dd.Manager, d.DeptName = dd.DeptName
WHEN NOT MATCHED THEN
INSERT (DeptID, DeptName, Manager)
VALUES (dd.DeptID, dd.DeptName, dd.Manager)
WHEN SOURCE NOT MATCHED THEN
DELETE;

Thursday, January 24, 2008

SQL Server 2005: CLR Integration Team Blog

SQL Server 2005: CLR Integration Team Blog - samples, tips and tricks, insights from the CLR Integration team at SQL Server.
CLR Trigger for Automatic Registration of UDXs on CREATE ASSEMBLY

Lutz Roeder's Programming.NET Site

Lutz Roeder's Programming.NET site. You can find there tools and source code for .NET, C# and Visual Basic. Reflector is a popular class browser. Resourcer is a .NET resource editor.

Monday, January 21, 2008

Regular Expressions Resources

Regular-Expressions.info - the premier website about Regular Expressions.
www.regexlib.com - the regular expressions library and a good collection of regular expresions related tools and books from around the internet.

Improving Performance with SQL Server 2005 Indexed Views

The document Improving Performance with SQL Server 2005 Indexed Views describes the improved indexed views capability of SQL Server 2005 Enterprise Edition. Indexed views are explained and specific scenarios in which they may provide performance improvements are discussed.

Implementing Row- and Cell-Level Security Using SQL Server 2005

The paper Implementing Row- and Cell-Level Security in Classified Databases Using SQL Server 2005 describes how SQL Server 2005 can be used to support row- and cell-level security (RLS/CLS). The examples provided in this white paper show how RLS and CLS can be used to meet classified database security requirements.