How do you force index scan instead of a seek, or read a table without using any index? Two reader questions with a similar answer, using a query hint.
SQL Injection: How It Works and How to Stop It
Prevent SQL injection by separating values from command text, parameterizing dynamic SQL, and validating object names before using QUOTENAME.
SQL SERVER – Improve Performance by Reducing IO – Creating Covered Index
My T-SQL Tuesday #004 post on how a covered index can improve performance by reducing IO. Run the demo on a test server only, never on production.
ATN2: Keep the Quadrant When Calculating an Angle
ATN2 uses two components to calculate an angle while retaining its quadrant. I keep the argument order and angle unit visible. Dividing one component by the other would lose useful information and introduce a zero-denominator case.
Replacing Old Syntax in Legacy T-SQL
Modernize legacy T-SQL by replacing old joins, TEXT columns, and fragile RAISERROR forms with clear, tested alternatives.
Modeling Data Before Writing Tables
Modeling data before tables clarifies entities, relationships, keys, and grain so schema changes do not discover the rules too late.
SQL SERVER – Order of Columns in Update Statement Does not Matter
Does the order of columns in UPDATE statements matter? No. Setting Col1 before Col2 or the other way round gives the same result in SQL Server.
SQL SERVER – Rollback TRUNCATE Command in Transaction
Many believe TRUNCATE cannot be rolled back. It can. Here is a Rollback TRUNCATE command example inside a transaction, and why TRUNCATE is logged.
SQL SERVER – Performance Comparison – INSERT TOP (N) INTO Table – Using Top with INSERT
A Performance Comparison of INSERT TOP (N) INTO a table versus INSERT with SELECT TOP (N). The first is clearly faster, but the two can give very different results.
TechEd Sri Lanka 2010: Two Sessions and a Room Full of Questions
TechEd Sri Lanka ran at Waters Edge in Colombo from February 8 to 10, 2010, and I presented two sessions there. This post looks back at the index session, rated 8.9, and the change data capture session, rated 7.8, and what each one still teaches. It also shares attendee feedback and photos of the people who made the event.










