In SQL Server, I’ve the following design:

Is it 100% sure that the first condition from the OR statement in a JOIN will be executed first ? So that the following SQL statement will result in the green result?
SELECT P.Name, D.Percentage
FROM Personnel P
JOIN Department D ON
P.Dep_Code = D.Code AND
(P.SubDep_Code = D.SubCode OR D.SubCode = '*')
No. There is no guaranteed order of evaluation and even if there where the entire expression would still evaluate to the same value and would not influence what rows are matched in the join.
Your query will give this result:
I guess you are looking for something like this.
You can try the queries here using SQL Server 2008. https://data.stackexchange.com/stackoverflow/qt/118492/