Category Archives: Joy of T-SQL

T-SQL: Improve the Performance for LIKE Wildcard by Changing the Collation

Well, I published new article about how to tune the performance for LIKE wildcard queries… Please navigate to this article on Microsoft TechNet Wiki  I’ll also publish it on this blog soon! 🙂

Posted in Best Practices, Joy of T-SQL, SQL General Information, T-SQL Tips & Tricks

TNWikiSummit15 Presentation: Error Handling in SQL Server 2012 and 2014

  The follow text is copied from this blog: Official Blog of TechNet Wiki   Using Error Handling within the Transact SQL language needs a deep knowledge. It depends on the SQL Server version, there are various implementations for handling the … Continue reading

Posted in Best Practices, Joy of T-SQL, SQL General Information, T-SQL Tips & Tricks

Webinar: Error Handling in SQL Server

    March 19, 2015 9:45 PM GMT Saeid Hasani Structured Error Handling in SQL Server The goal of this session is to provide a simple and easy to use error handling mechanism with minimum complexity. This session is compatible … Continue reading

Posted in Best Practices, Joy of T-SQL, SQL General Information, T-SQL Tips & Tricks

T-SQL: Delete All Rows From a Table Except Top(N) Rows

I added the article which comes from a question that asked in MSDN forum. The problem is how to delete all rows from a table but remain the Top (N) rows, for example, remaining only the top (1000) rows. All Code samples … Continue reading

Posted in Best Practices, Joy of T-SQL, SQL General Information, T-SQL Tips & Tricks

T-SQL: Simplified CASE expression

My last article is providing in depth tutorial about these statements: ISNULL COALESCE IIF CHOOSE The main purpose of introducing these statements is improving code readability and achieving cleaner code. Using these statements may result to poor performance in some … Continue reading

Posted in Best Practices, Joy of T-SQL, T-SQL Tips & Tricks

Parameter-driven ASC/DESC Sort ( CASE in ORDER BY )

This post is came up from a MSDN forum post that discussed last night . Problem was to write CASE in ORDER BY cluase without using dynamic sql. This is my solution that I just want to share it.

Posted in Joy of T-SQL, T-SQL Tips & Tricks | Leave a comment

List all objects that have Trigger

This is very simple to retrieve this data from “sysobjects”. Note that this query returns DML triggers in database.

Posted in Joy of T-SQL, T-SQL Tips & Tricks | Leave a comment

Dynamic SQL and Object Dependency

One of the most powerful features in MSSQL SERVER is dynamic sql that has its own complexity. When we use this feature, it’s very important that we must know its limitations and correct usage of it. By design, we limit … Continue reading

Posted in Joy of T-SQL, T-SQL Tips & Tricks | Leave a comment

column-level change tracking

Recently, I worked a lot with change tracking that’s new feature in Sql Server 2008. Now I just wanna share somethings about select changes at column level. Later, I will publish a very complete article about change tracking.

Posted in Joy of T-SQL | Leave a comment

SCHEMABINDING

SCHEMABINDING is a property that very useful for safety in views. If anyone wanna to change the table column that our view use it, “SCHEMABINDING” do not allow that chang. In some cases such as “Indexed views”, using “SCHEMABINDING” in view creation script is … Continue reading

Posted in Joy of T-SQL | Leave a comment