Here’s a bit of code that’ll let you modify any command text LINQ To SQL generates before it hits the database. It’s always been possible to call DataContext.GetCommand and use modified SQL in a call to DataContext.Translate or DataContext.ExecuteQuery, but that’s pretty restrictive in the complexity of query you can use. Also, if LINQ To SQL decides it needs to batch multiple SELECT statements for the desired results, GetCommand can only give you the first one. The first thing to do is replace the IProvider implementation used by your DataContext. Unfortunately, DataContext’s Provider property is both private and read-only. Also, the IProvider interface itself is private. This is bad in every way, and we absolutely shouldn’t try to hack our way through that… but we will.