Click here to Skip to main content
16,015,518 members

Comments by Hugo de Vreugd (Top 2 by date)

Hugo de Vreugd 5-Jun-13 2:36am View    
Reason for my vote of 2 \n I think there is a typo in the last SQL statement, it should be A.bid IS NULL.
More important: "SELECT * FROM B as B1 WHERE NOT EXISTS(SELECT * FROM A WHERE A.BID=B.BID)" is not as bad as you think. The suggestion of "NOT EXISTS SQL gets called once for each row in the B table" will depend on the execution plan, and I think the plans for both queries will be the same in most database systems.
Hugo de Vreugd 5-Apr-13 2:21am View    
Reason for my vote of 1 \n This is bad programming and can be solved set-based, for example by using a where clause like:
datediff(d, convert(varchar(4), year(@currdate)) right(convert(varchar(10), dob, 112), 4), @currdate) between 0 and 3
or datediff(d, convert(varchar(4), year(@currdate) 1) right(convert(varchar(10), dob, 112), 4), @currdate) between -3 and 0
And this is probably not the shortest or most efficient solution.