—-Option 1
SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE LOWER(sc.TEXT) LIKE ‘%name%’
—-Option 2
SELECT DISTINCT o.name, o.xtype
FROM syscomments sc
INNER JOIN sysobjects o ON sc.id=o.id
WHERE LOWER(sc.TEXT) LIKE ‘%name%’
Visual Basic Operators: ‘AndAlso’ & ‘OrElse’
Since I’ve mostly been using C# for the past few years, I sometimes get confused when I come across a Visual Basic application and have to distinguish between the newer operators (OrElse, AndALso vs Or, And)
Operator: OrElse
This example uses the OrElse operator to perform logical disjunction on two expressions. The result is a Boolean value that represents whether either of the two expressions is true. If the first expression is True, the second is not evaluated. If the first expression is false then the second expression is evaluated.
Dim A As Integer = 10
Dim B As Integer = 8
Dim C As Integer = 6
Dim myCheck As Boolean
myCheck = A > B OrElse B > C ‘ True. Second expression is not evaluated.
myCheck = B > A OrElse B > C ‘ True. Second expression is evaluated.
myCheck = B > A OrElse C > B ‘ False.
Operator: Or (if either expression evaluates to true then true will be returned)
Dim A As Integer = 10
Dim B As Integer = 8
Dim C As Integer = 6
Dim myCheck As Boolean
myCheck = A > B Or B > C ‘ Returns True.
myCheck = B > A Or B > C ‘ Returns True.
myCheck = B > A Or C > B ‘ Returns False.
Operator: AndAlso (if first expression evaluates to false then second expression is not evaluated)
Dim a As Integer = 10
Dim b As Integer = 8
Dim c As Integer = 6
Dim firstCheck, secondCheck, thirdCheck As Boolean
firstCheck = a > b AndAlso b > c ‘ Returns True.
secondCheck = b > a AndAlso b > c ‘ Returns False
thirdCheck = a > b AndAlso c > b ‘ Returns False
Operator: And (both expressions are evaluated)
Dim a As Integer = 10
Dim b As Integer = 8
Dim c As Integer = 6
Dim firstCheck, secondCheck As Boolean
firstCheck = a > b And b > c ‘ Returns True.
secondCheck = b > a And b > c ‘ Returns False
Ideally, the short circuit operations, you’re saving on the extra condition check when the first one is satisfied (OrElse) or not satisfied (AndAlso). So these should give you better performance in general.
OrElse: http://msdn.microsoft.com/en-us/library/ea1sssb2.aspx
AndAlso: http://msdn.microsoft.com/en-us/library/cb8x3kfz.aspx
XBox Game Review: Homefront
Despite the nagging voice in the back of my head that this game would be all hype, I was looking forward to this game so much that I pre-ordered it anyway. Bad idea.
The story was interesting — Both North and South Korea join up with Japan to make a super-army that invades the United States. Having grown up in the Red Dawn era, the story inspired a touch of fear in me; however, this was quickly flamed out.
Game-play was rather sloppy. Auto-aim only worked for enemies that were really close so perhaps the PC version is better.
The graphics were not worth mentioning. Many of the same objects were re-used throughout the entire game.
The one good surprise was the multi-player mode. Though not terribly extensive, the game-play was enjoyable. Regardless, I decided not to invest in multi-player mode and also did not play this game back through for the achievements. Instead, I took it to GameStop to trade in for Crysis 2 for as much money as possible before the inevitable price-drop that is soon to arrive.
SQL: UNION vs. UNION ALL
I try to avoid UNION clauses in most SQL that I write. Historically, they have taken too much of a toll on performance. Now we have a speedier alternative to the UNION clause — UNION ALL.
In a nutshell, a UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it gives faster results.
This difference is that UNION ALL will not eliminate duplicate rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into a table.
UNION Definition:
The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.
UNION ALL Definition:
The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.
A great reference can be found in Pinal Dave’s blog.
Xbox Game Review: Call of Duty – Black Ops
I was looking forward to the story-line in this game but ended up hating it. I switched the game to “Easy” mode just so I could get away from the repetitive, screeching, nails-on-the-chalkboard What do the numbers mean!!!” It seems that whenever Activision gets involved, then the Call Of Duty series goes downhill a ways.
The game-play is good and the the graphics are superb. Out of the majority of the other games, it should be a top-ranker in my book … but it is not. Like I mentioned, the campaign became so annoying that I had to force myself to finish it. My intentions have been to play it back through to get some achievement points out of it but this has not happened.
On the other hand, multi-player is excellent. For those non-competitive types who want to just run around with friends and shoot, “Combat Training” mode is excellent as well. For multi-player alone, I’ll hold on to this game for a while.