sylvar: (Hmmm. (Giles))
[personal profile] sylvar
So I'm learning Transact-SQL for Sybase, particularly as it applies to our library automation system, and someone asks "How can I get a list of all books with all-capital titles?"

Offhand I thought this would work:

select bib.bib#, title.processed
from bib, title
where bib.bib# = title.bib#
and title.processed = upper(title.processed)


But it turns out that our SQL server was installed as case-insensitive for developers' convenience, so the answer is that you can't do it this way. But you can if you do a loop through all lower-case letters of the alphabet (preferably from a table of letter frequency), breaking if you find any lower-case letters (searching by ASCII code), and printing the book's title if none are found. (This also includes books like "1, 2, 3", but that's a minor problem.

You shouldn't do this because it's time-consuming to check the entire title of every single book. It wouldn't be necessary to do this if the server were case-sensitive, but oh well.

The better answer is to export a list of titles to a text file and pipe it through a script that does what case-insensitive installations of SQL can't do.

Ugh. Perl Boy here was trying 'eq', '==', and all sorts of other operators until this finally dawned on him...

Date: 2005-02-15 03:58 pm (UTC)
From: [identity profile] ratcliffe1963.livejournal.com
I dunno...you could have people argue both sides of this...I guess it is all in what you are used to, but case insensitivity has made my life a lot easier in numerous ways. I guess you could say it just encourages laziness on the part of the querier/developer...the type of query he is suggesting is probably pretty rare ...

Date: 2005-02-15 06:56 pm (UTC)
ximinez: (Default)
From: [personal profile] ximinez
You say to-may-to. I say to-mah-to.

November 2010

S M T W T F S
 123456
78910111213
14151617181920
21222324 252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 25th, 2025 09:28 pm
Powered by Dreamwidth Studios