Trick SQL Server to use the best Execution Plan

What is the two most important words that one should look for in SQL Server Execution plan?  Scan ! Seek!

SCAN a big table is a disaster. The rescue is: try your best to let SQL  Server SEEK a big table.

(William Wolf taught me this many many years ago at a SQL Saturday meeting. This knowledge is so powerful and it makes one of my query work so good that I want to share with you.)

Continue reading “Trick SQL Server to use the best Execution Plan”

Look at me! I made the fire!

In the movie Cast Away, the character (by Tom Hanks) danced and jumped around a bonfire on beach and shouted many times: “look at me! I made the fire!”, even though he knew that nobody could look at him at that isolated, far away island. He simply could not stop celebrating his exciting achievement. That is exactly same feeling on a late Friday afternoon, after I figure out how to solve two of my problems at same time. Those two problems are: first. let SSRS pass a parameter to a query in DB2, and second, that parameter could be one or several account_ID.

Continue reading “Look at me! I made the fire!”

Scheduling SQL Job with SSRS

Imagine this: you are  at an technical interview of a SQL developer position. The interviewer asks: tell me someway to schedule an SQL server job without using SQL Server agent. If I am at this kind of situation, I will be surprised by the question.  I probably will miss the question and only focus on find out the reason not to use SQL Server Agent.

The fun thing is: I am going to share our unconventional ways to schedule SQL jobs (so that you won’t be surprised when you are asked about it)

Continue reading “Scheduling SQL Job with SSRS”

Dynamic! Dynamic!

Dynamic is one of my favorite search words. It is the opposite of “static”. A lot of time, SQL statements requires static input, such as column name and table name in SELECT.  However, Dynamic SQL gives a way to overcome this requirement.  This post I will share with you other two usages of ‘dynamic’.

Continue reading “Dynamic! Dynamic!”

Brain Twister in SQL

My kids and I love tongue twisters. We say tongue twister loudly in the car and they giggle and laugh loudly. I love to hear them giggle and laugh.

As I  work full time as a SQL developer, I write and read SQL code much more often than when I was a SQL blogger. When I  see SQL some code, I think: this is good. But, can you find a better way? Furthermore, what is the best way? These questions tickle my brain and when I find some answer, my brain giggles and laughs. I love that feeling.

Today, I want to share two SQL brain twisters (that comes from my work) with you. Continue reading “Brain Twister in SQL”

SSAS Udemy Course

As part of my effort to explore AI, I need to deeper my knowledge of multi-dimensional data model, I take this Udemy course: SQL Server Analysis Services – SSAS, Data Mining and Analytics. 

It is a pretty good course, with a lot of good examples of MDX query. As a person with SQL background, I feel that for a machine (or AI), MDX is easier to write than SQL because how to join tables are skipped in MDX. I guess, Power BI Q&A translate natural language questions to MDX, not SQL. I will find out that later.

Come back to the course, I recommend it to anyone who is interested in learning SSAS.