SQL Tip: Multi Server queries

My coworkers ask me from time to time to "do that magical thing you do" and then ask me to share with them how to do it. I have showed it several times...so now I'm going to blog it for reference. ๐Ÿ™‚ That "magical" thing I do is pretty simple and stems from me being … Continue reading SQL Tip: Multi Server queries

Advertisements

SQL Tip: The Tally Table

This is going to be a short blog because there are far better articles on the Tally Table that you should read (Iโ€™ll provide a link or two). However, I felt it important to create a post on this since some of my scripts make use of just such a table. The tally table is … Continue reading SQL Tip: The Tally Table

SQL Tip: LEFT JOINs and WHERE clauses…are they really LEFT JOINs?

There are times when I review SQL queries and find people using LEFT OUTER JOINs but then use WHERE clauses that turn those joins into INNER JOINs. Recently as I mentioned this to someone they reminded me that I should blog about it...so here I am blogging about it. ๐Ÿ™‚ First off, if you aren't … Continue reading SQL Tip: LEFT JOINs and WHERE clauses…are they really LEFT JOINs?

SQL Tip: Create comma separated string from values in a column (& COALESCE)

[edit: April 2019] This was originally posted to my internal (to Microsoft) blog on March 19, 2012 as part of a series I called 'SQL Tips' for coworkers and an email distribution list people could sign up to. I have left this as originally written but have updated formatting for my WordPress theme. Note: there … Continue reading SQL Tip: Create comma separated string from values in a column (& COALESCE)

SQL Tip: Returning a portion of a string field – dynamically (CHARINDEX)

[edit: April 2019] This was originally posted to my internal (to Microsoft) blog on May 1, 2012 as part of a series I called 'SQL Tips' for coworkers and an email distribution list people could sign up to. I have left this as originally written but have updated formatting for my WordPress theme. I canโ€™t … Continue reading SQL Tip: Returning a portion of a string field – dynamically (CHARINDEX)

SQL Tip: Creating a Grand Total (and additional subtotals)

[edit: April 2019] This was originally posted to my internal (to Microsoft) blog on Jan 23, 2012 as part of a series I called 'SQL Tips' for coworkers and an email distribution list people could sign up to. I have left this as originally written but have updated formatting for my WordPress theme. Sometimes when … Continue reading SQL Tip: Creating a Grand Total (and additional subtotals)