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...
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

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. 26th, 2025 05:49 am
Powered by Dreamwidth Studios