No book is perfect...
the following typos have been found in Tips, Tricks & Recipes for Sybase ASE.
Errata affecting code samples are also included in the electronic supplement, so you may want to download a recent copy (see appendix D of the book for directions).
page 5: 3rd-last bullet
The 3rd-last bullet should read rel12503/1919, matching the version string on the top of page 5, instead of rel12501/1778.
page 13: 1st query
In the 1st query on this page, the function syb_quit() won't work on pre-12.0, since syb_quit() was only introduced in 12.0. To make this example work correctly, change syb_quit() to set background on, as explained in section 3.3.2.
page 19: sp_feature_exists
In the second print statement ('Dear DBA...'), the single quote in I'm sorry should be changed to two single quotes as follows:
print 'Dear DBA: I''m sorry for the above error messages…'
page 75: last query
The query at the bottom should divide by a different value. The correct query is:
select name 'Database',
lct_admin('num_logpages', dbid) 'Used log pages',
lct_admin('logsegment_freepages',dbid) 'Available log pages',
str(lct_admin('num_logpages', dbid) * 100.0 /
lct_admin('num_logpages', dbid)) ,5,1) '%full'
page 96: 2nd query
The 2nd query returns one unit too many for each key value having duplicates. The correct query is as follows (-1 was added inside the sum() aggregate):
select count(count(*)) '#key values with duplicates',
sum(count(*)-1) '#rows with duplicate keys'
group by KeyCol1, KeyCol2, KeyCol3
having count(*) > 1
page 98: 2nd query
The 2nd query works correctly when there are single duplicate values for each duplicate key. When there are multiple duplicates for a key, it returns a duplicate count that is too high. The correct query is as follows:
select count(distinct t1.RowID) '#duplicates'
from DupTest t1, DupTest t2
where t1.KeyCol = t2.KeyCol
and t1.RowID > t2.RowID
page 98: 3rd query
The 3rd query works correctly when there are single duplicate values for each duplicate key. When there are multiple duplicates for a key, it returns a duplicate count that is too high. The correct query is as follows:
select t.KeyCol, count(distinct t.RowID) '#duplicates'
from DupTest t, DupTest t2
where t.KeyCol = t2.KeyCol
and t.RowID > t2.RowID
group by t.KeyCol
page 130/131: Logical I/O counts
The logical I/O counts on pages 130 and 131 have erraneously been interchanged. The I/O counts for 4 and 400 logical I/Os on page 130 should be swapped with those for 10 and 1000 logical I/Os on page 131. Otherwise, the code fragments are correct.
page 137: middle of page
In the phrase "Both queries return the two values that are missing from TabA", 'TabA' should be replaced by 'TabB'.
page 139: remark about query at the top of the page
It should be noted that this query assumes columns KeyA1, KeyA2, KeyB1 and KeyB2 not to contain NULL values.
page 139: last paragraph
The phrase "[...] while ANSI outer joins do have this restriction[...]" should be: "[...] while ANSI outer joins do not have this restriction[...]".
page 177: line 2
The words "must not be specified" should be "must be specified".
page 184: second bullet from bottom (numbered '1'); second line
The words "without only" should be "with only".
page 255: last two lines
The words "to do temporary tables" should be "to do with temporary tables".
page 292/293: Inadvertently specifying a transaction name (2)
Near the bottom of page 292, the following lines of code appear:
This should be:
1> begin tran
In connection with this error, the last line of the paragraph at the top of page 293 currently reads: "I should have written begin tran on line 1 and exec MyProc on line 2..." This sentence should be changed to "I should have written exec MyProc on line 2..."
If you notice
any further typos, please send an email to firstname.lastname@example.org.