Errata

Refactoring SQL Applications

Errata for Refactoring SQL Applications

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 8
code example at top of page

The query below has an order by that is invalid. a.creation_time does not exist in the derived table.

select a.*
from (select execution_count,
total_elapsed_time ,
total_logical_reads,
substring(st.text, (qs.statement_start_offset/2) + 1,
((case statement_end_offset
when -1 then datalength(st.text)
else qs.statement_end_offset
end
- qs.statement_start_offset)/2) + 1) as statement_text
from sys.dm_exec_query_stats as qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as st ) a
where a. statement_text not like '%select a.*%'
order by a.creation_time;

Note from the Author or Editor:
The query should be changed to:

select a.*
from (select execution_count,
total_elapsed_time ,
total_logical_reads,
substring(st.text, (qs.statement_start_offset/2) + 1,
((case statement_end_offset
when -1 then datalength(st.text)
else qs.statement_end_offset
end
- qs.statement_start_offset)/2) + 1) as statement_text
from sys.dm_exec_query_stats as qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as st ) a
where a. statement_text not like '%select a.*%'
order by a.total_elapsed_time desc;

Anonymous  Mar 09, 2010  Jun 12, 2015
Printed
Page 44
the last paragraph

"When you define a constraint on a table that says that one set of columns uniquely identifies a row in the column, ..."

Should the part of "a row in the column" be "a row in the table"?

Note from the Author or Editor:
Replace p 44 (Chapter two), last paragraph, third line, 'one set of columns uniquely identifies a row in the column' by 'one set of columns uniquely identifies a row in the table'.

Anonymous  Oct 06, 2008  Jun 12, 2015
Printed
Page 118
3rd paragraph

Should the sentence "If you multiply columns, ..." be "If you multiply rows, ..." ?

Note from the Author or Editor:
p. 118, paragraph tha follows the paragraph with a bullet point, 4th line:
"If you multiply columns" should be "If you multiply rows".

Anonymous  Oct 16, 2008  Jun 12, 2015
PDF
Page 252
Ireland

this is the SQl Server script

in the generatedata script you have :

PreparedStatement st2 = con.prepareStatement("insert into area_accounts(areaid,"
+ "accountid)"
+ "select ?,?"
+ " from dual"
+ " where not exists (select 1"
+ " from area_accounts"
+ " where areaid=? and accountid=?)");

the issue is "from dual"

Dual table in sql server so just remove the line to:

PreparedStatement st2 = con.prepareStatement("insert into area_accounts(areaid,"
+ "accountid)"
+ "select ?,?"
+ " where not exists (select 1"
+ " from area_accounts"
+ " where areaid=? and accountid=?)");

Tom Newman  May 09, 2012