This confused me for a few minutes today and I wanted to share to help avoid further confusion.   The specific code was this: Names have been changed to protect the innocent.   In the above delete statement which table will have rows deleted from it? A: Table1 B: Table2 C: Both Table1 and Table2 D: Neither Table1 and Table2  

During my 24 Hours of Pass presentation on Advanced CTE’s today I was asked the question about deleting from a CTE when it uses an EXISTS statement that queries another table. I figured I would create quick blog post to show the example. First some background when using the delete statement with a CTE you can’t delete if the query inside …

Deleting from a CTE with an EXISTS statement Read more »

On Wednesday June 24th at 6:00pm pacific time or( 25 Jun 2015 01:00 GMT ) will be speaking at the 24HOP (24 Hours of Pass) conference which is broadcast online. I will be presenting on Advanced Common Table Expressions, and it is going to be fun.   Here is the session abstract. You have been introduced to Common Table Expression, you understand …

Advanced Common Table Expressions – 24 Hours of PASS Read more »

The seventh week of ten in the Database Corruption Challenge went well. There were a few new participants, and many of those who have competed week over week. The first to submit a correct answer this week was Raul Gonzalez. What was interesting about this challenge was that it was not your typical corruption where you could just run DBCC CheckDB and …

Week 7 Database Corruption Challenge Results Read more »

Most DBAs know the usual difference between TRUNCATE and DELETE FROM, however one not so obvious difference between the two is how things are handled if the table is corrupt. For instance, if you look at the corrupt database from the Database Corruption Challenge Week 1, you see the following If you want to clear out the corrupt Revenue table, …

Difference Between TRUNCATE TABLE and DELETE FROM Table Read more »

I will be attending SQL Saturday #265 in Portland Oregon on November 16th 2013. This will be my second time attending SQL Saturday in Portland, and it is looking to be a great event. There are some great speakers on the line up that I am looking forward to learning from. I will be presenting 2 sessions on Common Table …

SQL Saturday #265 in Portland Oregon Read more »

I used to be able to do the Common Table Expression in a single 1 hour session, but after writing the book on Common Table Expressions, I discovered that I just can’t fit it into an hour with the detail that Common Table Expressions deserve. I would rather go into depth so that everyone can master CTEs rather than just breezing …

Common Table Expressions Presentations Updated. Read more »

My Common Table Expression presentation was accepted for SQL Saturday 212 in Redmond WA. This is the session that I am the most familiar with, and that I have presented the most times. I think this will be the 8th time I have presented this session, and after every previous presentation it has been improved. Over the last several months …

Common Table Expression accepted for SQL Saturday 212 in Redmond WA Read more »