Errata for Inside Microsoft® SQL Server™ 2005

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.

Updated version of Chapter 8 sample code available
An updated version of the sample file installed to "My DocumentsMicrosoft PressInside T SQL ProgrammingChapter 08 - Triggers.sql" is available for download from the Microsoft Download Center:
Ch8Trigr.exe
http://download.microsoft.com/download/f/6/d/f6df6fa4-18c3-46fa-922d-c8cbc2ea3851/ch8trigr.exe
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Additional code needed in sample
On page 17, the code sample at the bottom of the page is missing a line.
Change:
SELECT app,
(SELECT COUNT(*) FROM dbo.Sessions AS C
WHERE ts >= starttime
AND ts < endtime) AS cnt
FROM (SELECT DISTINCT app, starttime AS ts
FROM dbo.Sessions) AS T;To:
SELECT app,
(SELECT COUNT(*) FROM dbo.Sessions AS C
WHERE C.app = T.app
AND ts >= starttime
AND ts < endtime) AS cnt
FROM (SELECT DISTINCT app, starttime AS ts
FROM dbo.Sessions) AS T;

Microsoft Press

May 06, 2010

Printed

Page 18

Code missing from sample
On page 18, the code sample is missing a line.
Change:
SELECT app, MAX(cnt) AS mx
FROM (SELECT app,
(SELECT COUNT(*) FROM dbo.Sessions AS C
WHERE ts >= starttime
AND ts < endtime) AS cnt
FROM (SELECT DISTINCT app, starttime AS ts
FROM dbo.Sessions) AS T) AS D
GROUP BY app;To:
SELECT app, MAX(cnt) AS mx
FROM (SELECT app,
(SELECT COUNT(*) FROM dbo.Sessions AS C
WHERE C.app = T.app
AND ts >= starttime
AND ts < endtime) AS cnt
FROM (SELECT DISTINCT app, starttime AS ts
FROM dbo.Sessions) AS T) AS D
GROUP BY app;

Incorrect reference to information printed earlier in the chapter
On page 47, the first sentence of the last paragraph in the "Why Do We Need Complex Classes?" section reads:
"Note that as mentioned earlier in the chapter, the XML datatype can be adequate to store the state of objects using XML serialization in a database as well."
It should read:
"Note that the XML datatype can be adequate to store the state of objects using XML serialization in a database as well."

Drive letter missing in path to ComplexNumberCS.dl
On page 56, the second line of the first code sample reads:
FROM ' ComplexNumberCSComplexNumberCSinDebugComplexNumberCS.dll'It should read:
FROM ' C:ComplexNumberCSComplexNumberCSinDebugComplexNumberCS.dll'

Microsoft Press

Jul 13, 2010

Printed

Page 58

Incorrect complex number referenced
On page 58, the first sentence of the first sentence reads:
"You can see that the second complex number (2, 3i) is sorted before the first one (2, 3i)"
It should read:
"You can see that the second complex number (1, 7i) is sorted before the first one (2, 3i)"

.vsd file referenced in place of .vdx
On page 69, the last sentence of the paragraph following Figure 1-7 reads:
"To follow the demonstration, create the folder C:VisioFiles and copy the .vsd files from the bookâ€™s CD to that folder."
It should read:
"To follow the demonstration, create the folder C:VisioFiles and copy the .vdx files from the bookâ€™s CD to that folder."

Microsoft Press

May 06, 2010

Printed

Page 71

".value" used in place of "value"
On page 71, the first sentence of the last paragraph reads:
"I used the .value method of the XML data type."
It should read:
"I used the value method of the XML data type."

Microsoft Press

Jul 13, 2010

Printed

Page 74

The phrase "up to three" used in place of "three other types of"
On page 74, the second sentence of the first paragraph reads:
"After creating the Primary XML index, you can create up to three secondary XML Indexes:"
It should read:
"After creating the Primary XML index, you can create three other types of secondary XML Indexes:"

Microsoft Press

May 06, 2010

Printed

Page 77

Term Hobbie used in place of Hobby
On page 77, the third line of the last code sample reads:
BeerIt should read:
Beer

Microsoft Press

Jul 13, 2010

Printed

Page 78

Term Hobbie used in place of Hobby
On page 78, the third line of the list of errors reads:
English where element 'Foreign:Hobbie' was specified. Location: /*:Foreigns[1]/*:Hobbie[1]It should read:
English where element 'Foreign:Hobby' was specified. Location: /*:Foreigns[1]/*:Hobby[1]

Microsoft Press

May 06, 2010

Printed

Page 82

Term Hobbie used in place of Hobby
On page 82, the fifth line of the last code sample reads:
insert CigarIt should read:
insert Cigar

Microsoft Press

Jul 13, 2010

Printed

Page 92

Table #T2 referenced in place of table #T1
On page 92, the first line on the page reads:
"though proc2â€™s code creates a table called #T2 with two columns and loads a row with two"
It should read:
"though proc2â€™s code creates a table called #T1 with two columns and loads a row with two"

sp_droplinkedsrvlogin used in place of sp_addlinkedsrvlogin
On page 148, the third bullet point reads:
"Use the sp_droplinkedsrvlogin stored procedure to map local logins to a security account on the remote server."
It should read:
"Use the sp_addlinkedsrvlogin stored procedure to map local logins to a security account on the remote server."

Microsoft Press

May 06, 2010

Printed

Page 160

The term Inserts used in place of Updates
On page 160, the title of Table 4-6 reads:
"Table 4-6 Contents of Computations Table After Inserts"
It should read:
"Table 4-6 Contents of Computations Table After Updates"

Microsoft Press

Jul 13, 2010

Printed

Page 168

Underscore character treated as a wildcard character
On page 168, the seventh and eighth lines of the IF block in listing 4-7 read:
OR UPPER(@cols) LIKE UPPER(N'%xp_%')
OR UPPER(@cols) LIKE UPPER(N'%sp_%')They should read:
OR UPPER(@cols) LIKE UPPER(N'%xp[_]%')
OR UPPER(@cols) LIKE UPPER(N'%sp[_]%')

Microsoft Press

May 06, 2010

Printed

Page 169

Underscore character treated as a wildcard character
On page 169, the seventh and eighth lines of the IF block in listing 4-8 read:
OR UPPER(@cols) LIKE UPPER(N'%xp_%')
OR UPPER(@cols) LIKE UPPER(N'%sp_%')They should read:
OR UPPER(@cols) LIKE UPPER(N'%xp[_]%')
OR UPPER(@cols) LIKE UPPER(N'%sp[_]%')

Microsoft Press

Jul 13, 2010

Printed

Page 195

Missing terms from the code sample
On page 195, the ninth line of the first code sample reads:
JOIN dbo.VSalesRN AS PrvIt should read:
LEFT OUTER JOIN dbo.VSalesRN AS Prv

Microsoft Press

May 06, 2010

Printed

Page 197

JOIN used in place of LEFT OUTER JOIN
On page 197, the 13th line of the code sample reads:
JOIN CSalesRN AS Prv
It should read:
LEFT OUTER JOIN CSalesRN AS Prv

Microsoft Press

Jul 13, 2010

Printed

Page 202

sys.sql.modules referenced in place of sys.sql_modules
On page 202, the second sentence of the last paragraph on the page reads:
"If you donâ€™t specify the ENCRYPTION option, SQL Server stores the text defining the body of the object/routine as clear text in sys.sql.modules (or in syscomments in SQL Server 2000)."
It should read:
"If you donâ€™t specify the ENCRYPTION option, SQL Server stores the text defining the body of the object/routine as clear text in sys.sql_modules (or in syscomments in SQL Server 2000)."

Microsoft Press

May 06, 2010

Printed

Page 288

"schema" should be "owner"
On page 288, the first bullet point on the page incorrectly uses the word "schema".
Change:
"The stored procedure and the underlying objects belong to the same schema."
To:
"The stored procedure and the underlying objects belong to the same owner."

Microsoft Press

Jul 13, 2010

Printed

Page 303

Underscore character treated as a wildcard character
On page 303, the second and third lines read:
OR UPPER(@cols) LIKE UPPER(N'%xp_%')
OR UPPER(@cols) LIKE UPPER(N'%sp_%')They should read:
OR UPPER(@cols) LIKE UPPER(N'%xp[_]%')
OR UPPER(@cols) LIKE UPPER(N'%sp[_]%')

Microsoft Press

May 06, 2010

Printed

Page 332

Incorrect code sample
On page 332, the SELECT statement in the code sample reads:
SELECT COLUMN_NAME AS updated_column
FROM INFORMATION_SCHEMA.COLUMNS AS C JOIN @UpdCols AS U
ON C.ORDINAL_POSITION = U.ordinal_position
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'T1'
ORDER BY C.ORDINAL_POSITION;It should read:
SELECT COLUMN_NAME AS updated_column
FROM INFORMATION_SCHEMA.COLUMNS AS C JOIN @UpdCols AS U
ON COLUMNPROPERTY(OBJECT_ID(QUOTENAME(TABLE_SCHEMA)
+ '.' + QUOTENAME(TABLE_NAME)),
COLUMN_NAME, 'ColumnID') = U.ordinal_position
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'T1'
ORDER BY U.ORDINAL_POSITION;

Microsoft Press

Jul 13, 2010

Printed

Page 335

T1A used in place of T1
On page 335, the frist sentence at the top of the page reads:
"Query the tables T1Audit and T1A, and you will get the results shown in Tables 8-3 and 8-4, respectively:"It should read:"Query the tables T1Audit and T1, and you will get the results shown in Tables 8-3 and 8-4, respectively:

Microsoft Press

Jul 13, 2010

Printed

Page 335

The captions for tables 8-3 and 8-4 are reversed
On page 335, the caption for table 8-3 reads:
"Table 8-3 Contents of T1Audit"
It should read:
"Table 8-3 Contents of T1"
The caption for table 8-4 reads:
"Table 8-4 Contents of T1"
It should read:
"Table 8-4 Contents of T1Audit"

Microsoft Press

May 06, 2010

Printed

Page 345

.query method suggested in place of .value
On page 345, the first two sentences of the paragraph following the More Info box read:
"To extract a particular attribute from the XML value, you use the following XQuery expression: xml_value.query('data(//attribute_name)'). xml_value will typically be a variable to which you assigned the XML value returned by the eventdata function, and attribute_name is the name of the attribute you want to extract."
They should read:
"To extract a particular attribute from the XML value, you use the following XQuery expression: xml_value.value('()[1]', ). xml_value will typically be a variable to which you assigned the XML value returned by the eventdata function, and is the path to the attribute you want to extract."

.query used in place of .value in Listing 8-11
On page 348, lines 8-13 of the code in listing 8-11 read:
CAST(@eventdata.query('data(//PostTime)') AS VARCHAR(23)),
CAST(@eventdata.query('data(//EventType)') AS sysname),
CAST(@eventdata.query('data(//LoginName)') AS sysname),
CAST(@eventdata.query('data(//SchemaName)') AS sysname),
CAST(@eventdata.query('data(//ObjectName)') AS sysname),
CAST(@eventdata.query('data(//TargetObjectName)') AS sysname),They should read:
@eventdata.value('(/EVENT_INSTANCE/PostTime)[1]', 'VARCHAR(23)'),
@eventdata.value('(/EVENT_INSTANCE/EventType)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/LoginName)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/SchemaName)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/ObjectName)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/TargetObjectName)[1]', 'sysname'),

Microsoft Press

May 06, 2010

Printed

Page 349

.query used in place of .value in code sample
On page 349, the second line of the code sample before Table 8-11 reads:
CAST(eventdata.query('data(//TSQLCommand)') AS NVARCHAR(2000))It should read:
eventdata.value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]', 'NVARCHAR(MAX)')

Microsoft Press

Jul 13, 2010

Printed

Page 350

.query used in place of .value in listing 8-12
On page 350, lines 31-34 of Listing 8-12 read:
CAST(@eventdata.query('data(//PostTime)') AS VARCHAR(23)),
CAST(@eventdata.query('data(//EventType)') AS sysname),
CAST(@eventdata.query('data(//LoginName)') AS sysname),
CAST(@eventdata.query('data(//ObjectName)') AS sysname),
CAST(@eventdata.query('data(//LoginType)') AS sysname),
They should read:
@eventdata.value('(/EVENT_INSTANCE/PostTime)[1]', 'VARCHAR(23)'),
@eventdata.value('(/EVENT_INSTANCE/EventType)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/LoginName)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/ObjectName)[1]', 'sysname'),
@eventdata.value('(/EVENT_INSTANCE/LoginType)[1]', 'sysname'),

Microsoft Press

May 06, 2010

Printed

Page 353

"unsafe" used in place of "external"
On page 353, the line comment in the first code sample reads:
"-- Create login and grant it with unsafe permission level"It should read:
"-- Create login and grant it with external permission level"

Microsoft Press

Jul 13, 2010

Printed

Page 354

Comments in code sample incorrect
On page 354, the first comment in the code sample reads:// Check whether the action is InsertIt should read:
// Check type of action

Microsoft Press

May 06, 2010

Printed

Page 357

Comment in code sample incorrect
On page 357, the first line comment in the second block of code reads:' Check whether the action is InsertIt should read:
' Check type of action

Microsoft Press

Jul 13, 2010

Printed

Page 373

'Version 2' referenced rather than 'Version 1'
On page 373, the second sentence from the end of the page reads:
"You get the output 'Version 2', and the process keeps a shared lock on the data because the transaction is still open."
It should read:
"You get the output 'Version 1', and the process keeps a shared lock on the data because the transaction is still open."

Microsoft Press

May 06, 2010

Printed

Page 374

'Version 2' referenced rather than 'Version 1'
On page 374, the second sentence on the page reads:
"You still get 'Version 2' back, meaning you got a repeatable read even though another process attempted to change the data in between your reads."
It should read:
"You still get 'Version 1' back, meaning you got a repeatable read even though another process attempted to change the data in between your reads."

Microsoft Press

Jul 13, 2010

Printed

Page 388

Column name used is incorrect
On page 388, the second paragraph under Deadlock with a Single Table reads:
"Before I demonstrate such a scenario, let's first run the following UPDATE statement to make sure that T1.col2 is set to 102 where keycol =2:"
It should read:
"Before I demonstrate such a scenario, let's first run the following UPDATE statement to make sure that T1.col1 is set to 102 where keycol =2:"

Microsoft Press

May 06, 2010

Printed

Page 405

Missing phrase "code before the" in TRY block explination
On page 405, the first sentence of the last paragraph reads:
"The TRY block then sets @retry to 0 so that if all goes well, there wonâ€™t be another retry."
It should read:
"The code before the TRY block then sets @retry to 0 so that if all goes well, there wonâ€™t be another retry."

Microsoft Press

Jul 13, 2010

Printed

Page 435

"off" used in place of "on"
On page 435, the comment in the third code sample block from the bottom reads:-- Create the Inventory Queue which will be the target of-- the conversations. This is created with activation off.It should read:
-- Create the Inventory Queue which will be the target of-- the conversations. This is created with activation on.

Microsoft Press

May 06, 2010

Printed

Page 439

Comment in code sample is incorrect
On page 439, the second block comment in the code sample reads:-- Create the initiator queue. Activation is configured-- but turned offIt should read:
-- Create the initiator queue. This is created with activation on.

Microsoft Press

Jul 13, 2010

Printed

Page 440

"Hello World" used in place of "Inventory"
On page 440, the third line comment from bottom of code sample reads:-- Begin a dialog to the Hello World ServiceIt should read:
-- Begin a dialog to the Inventory Service

Microsoft Press

May 06, 2010

Printed

Page 446

Certificate name incorrect
On page 446, the first sentence of the third paragraph reads:"The private key certificate corresponding to the REMOTE SERVICE BINDING user of the initiator must have CONTROL permission on the target service, and the public key certificate corresponding to the initiator service ownerâ€™s certificate must have SEND permissions on the
target service."
It should read:
"The private key certificate corresponding to the REMOTE SERVICE BINDING user's certificate must have CONTROL permission on the target service, and the public key certificate corresponding to the initiator service ownerâ€™s certificate must have SEND permissions on the
target service."

Microsoft Press

Jul 13, 2010

Printed

Page 452

the word "Account" missing from code comment
On page 452, the last code line comment on the page reads:-- Grant Local System connect privilegeIt should read:
-- Grant Local System Account connect privilege

Microsoft Press

May 06, 2010

Printed

Page 473

Comment text is incorrect
On page 473, the 13th code line from the bottom of the page reads:// Check whether the action is InsertIt should read:
// Check type of action

Microsoft Press

Jul 13, 2010

Printed

Page 480

Comment text is incorrect
On page 480, the 17th line from the bottom of the page reads:
' Check whether the action is InsertIt should read:
' Check type of action
Microsoft Press is committed to providing informative and accurate
books. All comments and corrections listed above are ready for
inclusion in future printings of this book. If you have a later printing
of this book, it may already contain most or all of the above corrections.

Microsoft Press

May 06, 2010

Sign up today to receive special discounts, product alerts, and news from O'Reilly.