[nfbcs] Counting parentheses

Tracy Carcione carcione at access.net
Mon Oct 26 17:44:32 UTC 2015


Jim, I'm just using Notepad, or editing in the New Query panel in SQL
Server.  Should I be using something more sophisticated?

John and Gary, I'm trying to do what you said, but some of the closing
parens are a long way from the opening ones.  Guess my brain needs more
exercise.  And thanks John--clearly I'd better stick to betting the
ponies, and stay far away from Vegas. :.)

Aaron, it never occurred to me I could buy a new abacus.  I'll look into it.
Tracy

> Oh lord that sounds Tedious <grin>
>
> I don't know what editor you're using, but most editors have paren
> balancing keystrokes you can use to bounce between the opening and
> closing paren.  I've used this to great effect to figure out where
> I've dropped a paren.
>
> Jim
>
> On Mon, Oct 26, 2015 at 12:18:35PM -0500, John G Heim via nfbcs wrote:
>> Listen to the sql query a character at a time adding 1 to the count each
>> time you cursor over a left paren and subtracting one each time you
>> cursor
>> over a right paren.  It's like how they count cards in Vegas.
>>
>>
>> The only problem with this method is that you might get to the end of
>> the
>> query and discover that you are missing a parenthesis but it might not
>> be
>> clear where. What I would do in this case is do it again, this time
>> listening for the point where I know I should subtract 1 instead of add.
>> Or
>> just take a shot and put a right paren at the end which is almost always
>> the
>> solution anyway.
>>
>>
>>
>>
>> On 10/26/2015 12:01 PM, Tracy Carcione via nfbcs wrote:
>> >I am having trouble keeping track of parentheses in complicated SQL
>> >statements.  Perhaps when I know SQL better, it will be less confusing.
>> >Sometimes I have an abacus handy to keep track of counts, but not
>> always.
>> >What methods do people use to make sure there is a ) for each (?
>> >Thanks.
>> >Tracy
>> >
>> >
>> >
>> >_______________________________________________
>> >nfbcs mailing list
>> >nfbcs at nfbnet.org
>> >http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
>> >To unsubscribe, change your list options or get your account info for
>> nfbcs:
>> >http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jheim%40math.wisc.edu
>> >
>>
>> --
>> John Heim, jheim at math.wisc.edu, 608-263-4189, skype:john.g.heim,
>> sip:jheim at sip.linphone.org
>>
>> _______________________________________________
>> nfbcs mailing list
>> nfbcs at nfbnet.org
>> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
>> To unsubscribe, change your list options or get your account info for
>> nfbcs:
>> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jbar%40barcore.com
>>
>
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for
> nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/carcione%40access.net
>






More information about the NFBCS mailing list