Forgot your password?
typodupeerror

Comment Re:Of course! *My* code is the prettiest. (Score 1) 658

That was done specifically to enhance the readability of the code.

I check for the existence of a "where clause" sent in the arguments once at the top of the procedure and explicitly define one ( 1=1 ) if there wasn't one sent in.

That way in the next 5 spots in the code where I need to use that variable to build an SQL statement to exec, I can write simply:

... + 'where ' + @where_clause + ...

instead of having to have additional code in each of those 5 spots to check if I have a where_clause or not.

Looking at it now I suppose I could have just pre-pended the 'where ' onto the clause itself or left it set to '' and it would have worked just as well.

I blame the wine! :-)

CoderDude

Slashdot Top Deals

Any given program, when running, is obsolete.

Working...