Pro T SQL 2005 Programmer s Guide Expert s Voice 1st Edition Michael Coles - The ebook is now available, just one click to start reading
Pro T SQL 2005 Programmer s Guide Expert s Voice 1st Edition Michael Coles - The ebook is now available, just one click to start reading
https://ebookultra.com/download/pro-oracle-sql-expert-s-voice-in-
oracle-1st-edition-karen-morton/
https://ebookultra.com/download/the-definitive-guide-to-ireport-
expert-s-voice-1st-edition-giulio-toffoli/
https://ebookultra.com/download/pro-jpa-2-mastering-the-java-
persistence-api-expert-s-voice-in-java-technology-1st-edition-mike-
keith/
https://ebookultra.com/download/the-composer-s-voice-edward-t-cone/
Introducing Silverlight 4 Expert s Voice in Silverlight
1st Edition Ashish Ghoda
https://ebookultra.com/download/introducing-silverlight-4-expert-s-
voice-in-silverlight-1st-edition-ashish-ghoda/
https://ebookultra.com/download/foundations-of-asp-net-ajax-expert-s-
voice-in-net-2nd-edition-robin-pars/
https://ebookultra.com/download/professional-microsoft-sql-
server-2008-administration-wrox-programmer-to-programmer-1st-edition-
brian-knight/
https://ebookultra.com/download/excel-2007-vba-programmer-s-reference-
programmer-to-programmer-1st-edition-john-green/
https://ebookultra.com/download/sharepoint-2007-and-office-
development-expert-solutions-programmer-to-programmer-1st-edition-
randy-holloway/
Pro T SQL 2005 Programmer s Guide Expert s Voice 1st
Edition Michael Coles Digital Instant Download
Author(s): Michael Coles
ISBN(s): 9781590597941, 159059794X
Edition: 1
File Details: PDF, 5.95 MB
Year: 2007
Language: english
CYAN YELLOW
MAGENTA BLACK
PANTONE 123 C
Pro
• New and improved tools to interact with SQL Server, such as SQLCMD
and SQL Server Management Studio
• New ways to store, query, and manipulate XML using XPath, XQuery,
and the new xml data type
T-SQL 2005
• .NET integration via the SQL Common Language Runtime (SQLCLR)
• Integrated HTTP SOAP endpoints
• Built-in encryption statements and functions
• Several new T-SQL keywords and functions
• Enhancements to existing T-SQL statements
I wrote this book as a feature guide and reference work for developers who
want to take full advantage of the power of T-SQL on SQL Server 2005. This
book is particularly useful for experienced T-SQL and SQL programmers from
Programmer’s Guide
other platforms who want to harness the full power of T-SQL on the SQL Server
2005 platform. And because this book is a guide for developers, I have included
dozens of code samples that explore each topic as I introduce it. I have also
organized this book to serve as a handy reference guide for those times when
you just need a quick refresher on a specific function, or need to see the syntax
of one of the new T-SQL statements.
In all, I hope that after reading this book you will take with you a sense of the
power of T-SQL 2005, as well as the practical knowledge to take full advantage of the
newest member of the SQL Server family in your own application-development
endeavors. I’ve certainly enjoyed putting this T-SQL 2005 programming book
together, and I hope you find it valuable in your T-SQL development efforts.
Michael Coles, MCDBA, MCP The newest T-SQL features and functionality for
programmers on the SQL Server 2005 platform
Companion eBook
THE APRESS ROADMAP
Microsoft SQL Server
2005 High Availability
Beginning SQL Server 2005 Pro T-SQL 2005
for Developers Programmer’s Guide Pro SQL Server 2005
Database Design
See last page for details and Optimization
on $10 eBook version Beginning SQL Server
Pro SQL Server 2005
2005 Express for Developers
Pro SQL Server 2005
Replication
US $49.99
Shelve in
SQL Server
User level:
9 781590 597941
Intermediate–Advanced
this print for content only—size & color not accurate spine = 1.057" 560 page count
794Xfmfinal.qxd 3/29/07 4:17 PM Page i
Michael Coles
794Xfmfinal.qxd 3/29/07 4:17 PM Page ii
Contents at a Glance
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
v
794Xfmfinal.qxd 3/29/07 4:17 PM Page vi
794Xfmfinal.qxd 3/29/07 4:17 PM Page vii
Contents
vii
794Xfmfinal.qxd 3/29/07 4:17 PM Page viii
viii ■CONTENTS
■CONTENTS ix
CASE Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Simple CASE Expression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Searched CASE Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Scalar Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Recursion in Scalar UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Procedural Code in UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Multistatement Table-Valued Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Inline Table-Valued Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Restrictions on User-Defined Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Nondeterministic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
State of the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
32eeceee020b1b6c36f7005aec98cc94
794Xfmfinal.qxd 3/29/07 4:17 PM Page x
x ■CONTENTS
■CONTENTS xi
xii ■CONTENTS
■CONTENTS xiii
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
794Xfmfinal.qxd 3/29/07 4:17 PM Page xiv
794Xfmfinal.qxd 3/29/07 4:17 PM Page xv
xv
794Xfmfinal.qxd 3/29/07 4:17 PM Page xvi
794Xfmfinal.qxd 3/29/07 4:17 PM Page xvii
xvii
794Xfmfinal.qxd 3/29/07 4:17 PM Page xviii
794Xfmfinal.qxd 3/29/07 4:17 PM Page xix
Acknowledgments
T here are a lot of people I would like to acknowledge for helping to make this book a
reality. First, I’d like to thank the team at Apress. This book would not have been possible
without my editor, Jim Huddleston, who set the tone and got the ball rolling. I’d also like
to thank the keeper of the schedule, Denise Santoro Lincoln, whose dedication and per-
severance kept us all on track.
I’d like to thank my technical reviewer Alexzander Nepomnjashiy for keeping me
honest, copy editor Jennifer Whipple for keeping me consistent, production editor
Laura Esterman for making it look so good, and everyone else who contributed to
this book.
While I’m at it, I’d like to give special thanks to Steve Jones, Andy Warren, and
Brian Knight, three of the founders of SQL Server Central. These guys thought enough
of my writing to give me my first shot at writing for them. Thanks also to ASP Today edi-
tor Simon Robinson for publishing me and for introducing me to the team at Apress.
Thanks to my family, Jennifer, Chris, Deja, Desmond, and, of course, Mom and Eric
for your support. I’d also like to thank my good friends Rob and Laura Whitlock, and my
Army buddy Joe Johnson.
Thank you to my wonderful girlfriend Donna for all your support.
And most of all, thank you to Devoné and Rebecca for being my little angels.
xix
794Xfmfinal.qxd 3/29/07 4:17 PM Page xx
794Xfmfinal.qxd 3/29/07 4:17 PM Page xxi
Introduction
T his book examines SQL Server 2005 T-SQL from a developer’s perspective. It covers a
wide range of developer-specific topics in SQL Server 2005, from an introduction to new
developer tools such as SQLCMD and SQL Server Management Studio to new T-SQL
functionality such as the xml data type, XQuery support, and T-SQL encryption.
I wrote this book as a practical and useful guide to help you make the most of SQL
Server 2005 T-SQL. I provide a generous selection of sample T-SQL and, where appropri-
ate, .NET code to demonstrate specific functionality.
xxi
794Xfmfinal.qxd 3/29/07 4:17 PM Page xxii
xxii ■INTRODUCTION
Chapter 7: Triggers
SQL Server 2005 supports classic Data Manipulation Language (DML) triggers that per-
form actions when you insert, update, or delete rows in a table. Data Definition Language
(DDL) triggers, which fire in response to DDL events, are new to SQL Server 2005 T-SQL.
This chapter discusses both types of triggers.
794Xfmfinal.qxd 3/29/07 4:17 PM Page xxiii
■INTRODUCTION xxiii
xxiv ■INTRODUCTION
Prerequisites
At the time of writing, SQL Server 2005 Service Pack 1 was the latest production release.
All of the code samples in the book were developed on SQL Server 2005 Service Pack 1.
Because of changes to the SQL Server engine and to T-SQL in general, I cannot guarantee
compatibility with previous SQL Server 2005 releases, such as the CTP releases.
Most of the code samples were designed to be run against the AdventureWorks
sample database. If you do not have AdventureWorks, I highly recommend that you
download it from http://www.microsoft.com/sql.
Many of the code samples will run properly on SQL Server 2005 Express Edition, but
some will not due to differences in the available features. For example, SQL Server 2005
Express Edition does not support HTTP endpoints. For complete compatibility, use SQL
Server 2005 Standard Edition or better.
Finally, a lot of the code samples in Chapters 14, 15, and 16 are written in VB and C#.
These samples require the Microsoft .NET Framework 2.0 to run. If you want to compile
and tinker with the code samples, I highly recommend you use Microsoft Visual Studio
2005 for the best overall experience.
794Xfmfinal.qxd 3/29/07 4:17 PM Page xxv
■INTRODUCTION xxv
Source Code
As you read through the book, you may choose to type in some of the code samples by
hand because it provides more familiarity with the techniques and styles used. Or you
might want to compile, install, execute, modify, or study the code without entering it
manually. Either way, I highly recommend downloading the source and just generally
playing with it as you read the book.
All of the code is available in the Source Code/Download section of the Apress
website at http://www.apress.com.
Errata
Apress and the author have made every effort to ensure that there are no errors in the
text or the code for this book. However, to err is human, and as such we recognize the
need to keep you informed of any mistakes as they’re discovered and corrected. An
errata sheet will be made available on this book’s main page at http://www.apress.com.
If you find an error that hasn’t already been reported, please let us know.
The Apress website acts as a focus for other information and support, including the
code from all Apress books, sample chapters, previews of forthcoming titles, and articles
on related topics.
CHAPTER 1
T he history of Structured Query Language (SQL), and its direct descendant Transact-
SQL (T-SQL), all began in 1970 when Dr. E. F. Codd published his influential paper,
“A Relational Model of Data for Large Shared Data Banks,” in the Communications of
the ACM by the Association for Computing Machinery (ACM). In this paper Dr. Codd
introduced the definitive standard for relational databases. IBM went on to create the
first relational database management system, known as System R. IBM introduced the
Structured English Query Language (SEQUEL, as it was known at the time) to interact
with this early database to store, modify, and retrieve data. The name was subsequently
changed from SEQUEL to the now-common SQL because of a trademark issue. In 1987
the American National Standards Institute (ANSI) approved a standard for SQL known
as the ANSI SQL-86 standard.
Microsoft entered the relational database management system market in 1989
through a joint venture with Sybase and Ashton-Tate (of dBase fame) to create and
market SQL Server. Since then, Microsoft, Sybase, and Ashton-Tate have gone their
separate ways. Microsoft has introduced several upgrades to Microsoft SQL Server,
including Microsoft SQL Server versions 4.2, 4.21, 6.0, 6.5, 7.0, 2000, and 2005.
Through it all, T-SQL has remained SQL Server’s native tongue and the centerpiece
of SQL Server development.
Although based on the ANSI SQL-92 standard, T-SQL has integrated several ANSI
SQL:1999 standard features. In addition, T-SQL includes advanced procedural extensions
that go above and beyond the ANSI standards. These extensions include control-of-flow
statements, transaction control, error handling, SQLCLR integration, and more. With the
release of SQL Server 2005, Microsoft has expanded T-SQL to include several new features
to support SQLCLR integration, data encryption and decryption, Extensible Markup Lan-
guage (XML) support, and a wide assortment of additional functionality not available in
previous SQL Server releases.
This chapter begins with a discussion of T-SQL ANSI compatibility, then describes
declarative programming languages, and concludes with tips to help you create your own
T-SQL programming style that will help make maintaining and debugging your T-SQL
code as easy as possible.
1
794Xch01final.qxd 3/29/07 4:51 PM Page 2
1. The code explicitly opens the storage for input (in this example a flat file is
used as a “database”).
2. It then reads in each record (one record per line), explicitly checking for the
end of file.
3. As it reads the data, the code returns each record for display using
Console.WriteLine().
4. And finally it closes and disposes of the connection to the data file.
Consider what happens when you want to add or delete a name from the flat-file
“database.” In those cases, you must write routines to explicitly reorganize all the data
in the file so it maintains proper ordering. If you want the names to be listed and
retrieved in alphabetical (or any other) order, you must code sort routines as well. Any
type of additional processing on the data requires that you implement separate proce-
dural routines.
Declarative languages such as SQL, on the other hand, let you frame problems in
terms of the end result. All you have to do is describe what you want from SQL Server via
a query and trust the database engine to deliver the correct result as efficiently as possi-
ble. To continue the cab driver analogy from earlier, in a declarative language you would
tell the cab driver to take you to the airport and then trust that he knows the best route.
The SQL equivalent of the C# code in Listing 1-1 might look something like Listing 1-2.
SELECT FirstName
FROM Person.Contact;
■Tip Unless otherwise specified, you can run all the T-SQL samples in this book in the AdventureWorks
sample database using SQL Server Management Studio or SQLCMD.
To sort your data, you can simply add an ORDER BY clause to the SELECT query in
Listing 1-2. With properly designed and indexed tables, SQL Server can automatically
reorganize your data for efficient retrieval after you insert, update, or delete rows.
T-SQL includes extensions that allow you to override SQL Server’s declarative syntax.
In fact, you could rewrite the previous example as a cursor to closely mimic the C# sam-
ple code. More often than not, however, trying to force the one-row-at-a-time imperative
794Xch01final.qxd 3/29/07 4:51 PM Page 4
model on SQL Server hurts performance and makes simple projects more complex than
they need to be.
One of the great features of SQL Server is that you can invoke its power, in its native
language, from nearly any other programming language. In .NET you can connect and
issue SQL queries and T-SQL statements to SQL Server via the System.Data.SqlClient
namespace, which I will discuss further in Chapter 15. This gives you the opportunity to
combine SQL’s declarative syntax with the strict control of an imperative language.
Elements of Style
Selecting a particular style and using it consistently helps with debugging and code
maintenance. The following sections contain some general recommendations to make
your T-SQL code easy to read, debug, and maintain.
This query will run and return the correct result, but it’s hard to read. You can use
whitespace and table aliases to generate a version that is much easier on the eyes, as
demonstrated in Listing 1-4.
SELECT e.EmployeeID,
c.Title,
c.FirstName,
c.MiddleName,
c.LastName,
c.Suffix,
e.Title AS JobTitle,
c.Phone,
c.EmailAddress,
c.EmailPromotion,
a.AddressLine1,
a.AddressLine2,
a.City,
sp.Name AS StateProvinceName,
a.PostalCode,
cr.Name AS CountryRegionName,
c.AdditionalContactInfo
FROM HumanResources.Employee e
INNER JOIN Person.Contact c
ON c.ContactID = e.ContactID
INNER JOIN HumanResources.EmployeeAddress ea
ON e.EmployeeID = ea.EmployeeID
INNER JOIN Person.Address a
ON ea.AddressID = a.AddressID
INNER JOIN Person.StateProvince sp
ON sp.StateProvinceID = a.StateProvinceID
INNER JOIN Person.CountryRegion cr
ON cr.CountryRegionCode = sp.CountryRegionCode;
794Xch01final.qxd 3/29/07 4:51 PM Page 6
Notice the ON keywords are indented, associating them visually with the INNER JOIN
operators directly before them in the listing. The column names on the lines directly after
the SELECT keyword are also indented, associating them visually with the SELECT keyword.
This particular style is useful in helping visually break up a query into sections. The per-
sonal style you decide upon might differ from this one, but once you have decided on a
standard indentation style, be sure to apply it consistently throughout your code.
Code that is easy to read is, by default, easier to debug and maintain. The second ver-
sion uses table aliases, plenty of whitespace, and the semicolon (;) terminator to mark
the end of the SELECT statement in order to make the code more easily readable. Although
not always required, it is a good idea to get into the habit of using the terminating semi-
colon in your SQL queries.
■Note Semicolons are required terminators for some statements in SQL Server 2005. Instead of trying to
remember all the special cases where they are or aren’t required, it is a good idea to get into the habit of
using the semicolon statement terminator throughout your T-SQL code. You might notice the use of semi-
colon terminators in all the examples in this book.
Naming Conventions
SQL Server allows you to name your database objects, such as tables, views, procedures,
and so on, using just about any combination of up to 128 characters (116 characters for
local temporary table names) as long as you enclose them in double quotes (") or brack-
ets ([ ]). Just because you can, however, doesn’t necessarily mean you should. Many of
the allowed characters are hard to differentiate from other similar-looking characters,
and some might not port well to other platforms. The following suggestions will help you
avoid potential problems:
• Use alphabetic characters (A–Z, a–z, and Unicode Standard 3.2 letters) for the first
character of your identifiers. The obvious exceptions are SQL Server variable
names that start with the at sign (@), temporary tables and procedures that start
with the number sign (#), and global temporary tables and procedures that begin
with the double number sign (##).
• Many built-in T-SQL functions and system variables have names that begin with
a double at sign (@@), such as @@ERROR and @@IDENTITY. To avoid confusion and
possible conflicts, don’t use a leading double at sign to name your identifiers.
794Xch01final.qxd 3/29/07 4:51 PM Page 7
• Avoid embedded spaces, punctuation marks (other than the underscore charac-
ter), and other special characters in your identifiers.
• Avoid using SQL Server 2005 reserved keywords as identifiers (Appendix A lists
the SQL Server reserved keywords).
Finally, to make your code more readable, select a capitalization style for your
identifiers and code, and use it consistently. My preference is to fully capitalize T-SQL
keywords and use mixed case and underscore characters to visually “break up” identi-
fiers into easily readable words. Using all capital characters or inconsistently applying
mixed case to code and identifiers can make your code illegible and hard to maintain.
Consider the example query in Listing 1-5.
The all-capital version is difficult to read. It’s hard to tell the SQL keywords from the
column and table names at a glance. Compound words for column and table names are
not easily identified. Basically, your eyes work a lot harder to read this query than they
should have to, which makes otherwise simple maintenance tasks more difficult. Refor-
matting the code and identifiers makes this query much easier on the eyes, as Listing 1-6
demonstrates.
794Xch01final.qxd 3/29/07 4:51 PM Page 8
SELECT i.CustomerID,
c.Title,
c.FirstName,
c.MiddleName,
c.LastName,
c.Suffix,
c.Phone,
c.EmailAddress,
c.EmailPromotion
FROM Sales.Individual i
INNER JOIN Person.Contact c
ON c.ContactID = i.ContactID
INNER JOIN Sales.CustomerAddress ca
ON ca.CustomerID = i.CustomerID;
The use of all capitals for the keywords in the second version makes them stand
out from the mixed-case table and column names. Likewise, the mixed-case column
and table names make the compound word names easy to recognize. The net effect is
that the code is easier to read, which makes it easier to debug and maintain. Consistent
use of good formatting habits helps keep trivial changes trivial and makes complex
changes easier.
Listing 1-7. Stored Procedure Example with One Entry, Multiple Exits
INSERT
INTO Person.ContactType ([Name], ModifiedDate)
SELECT @Name, CURRENT_TIMESTAMP;
Listing 1-8 updates the previous example to give it a single entry point and a single
exit point, making the logic easier to follow.
AS
DECLARE @Err_Code AS INT;
SELECT @Err_Code = 0;
IF @ContactTypeID IS NULL
BEGIN
INSERT
INTO Person.ContactType ([Name], ModifiedDate)
SELECT @Name, CURRENT_TIMESTAMP;
This rule also applies to looping structures, which you implement via the WHILE
statement in T-SQL. Avoid using the WHILE loop’s CONTINUE and BREAK statements and the
GOTO statement; these statements lead to old-fashioned, difficult-to-maintain “spaghetti
code.”
SELECT o.name
FROM sys.objects o,
sys.views v
WHERE o.object_id *= v.object_id;
794Xch01final.qxd 3/29/07 4:51 PM Page 11
SQL responds to this query with one of the most elaborate error messages ever seen
in a Microsoft product:
As the error message suggests, you can use the sp_dbcmptlevel stored procedure to
revert the database compatibility to 80 (SQL Server 2000) to circumvent the problem.
As the error message also suggests, the old-style join operators will not be supported in
future versions, even in backward-compatibility mode. If you do have old-style joins in
your T-SQL code, the best course of action is to convert them to ANSI SQL standard
joins as soon as possible. Listing 1-10 updates the previous query to use the current
ANSI standard.
SELECT o.name
FROM sys.objects o
LEFT JOIN sys.views v
ON o.object_id = v.object_id;
■Note You can use sp_dbcmptlevel to revert various SQL Server behaviors to a version prior to SQL
Server 2000. Use a compatibility level of 80 for SQL Server 2000, 70 for SQL Server 7.0, 65 for SQL
Server 6.5, and 60 for SQL Server 6.0. You should avoid this unless you have a “compelling reason” for
reverting to old compatibility modes.
This book uses the ANSI SQL-92 syntax joins in its examples.
794Xch01final.qxd 3/29/07 4:51 PM Page 12
Avoid SELECT *
Consider the SELECT * style of querying. In a SELECT clause, the asterisk (*) is a shorthand
way of specifying that all columns in a table should be returned. Although SELECT * is a
handy tool for ad hoc querying of tables during development and debugging, you should
not use it in a production system. One reason to avoid this method of querying is to mini-
mize the amount of data retrieved with each call. SELECT * retrieves all columns, whether
or not they are needed by the higher-level applications. For queries that return a large
number of rows, even one or two extraneous columns can waste a lot of resources.
Also, if the underlying table or view is altered, your front-end application can receive
extra columns in, or columns could be missing from, the result set returned, causing
errors that can be hard to locate. By specifying the column names, your front-end appli-
cation can be assured that only the required columns are returned by a query and that
errors caused by missing columns will be easier to locate.
Initializing Variables
When you create stored procedures, user-defined functions, or any script that uses T-SQL
user variables, you should initialize those variables before the first use. Unlike other pro-
gramming languages that guarantee newly declared variables will be initialized to 0 or an
empty string (depending on their data types), T-SQL guarantees only that newly declared
variables will be initialized to NULL. Consider the code snippet shown in Listing 1-11.
DECLARE @i INT;
SELECT @i = @i + 5;
SELECT @i;
The result is NULL, a shock if you were expecting 5. Expecting SQL Server to initialize
numeric variables to 0 (like @i in the previous example), or an empty string, will result in
bugs that can be extremely difficult to locate in your T-SQL code. To avoid these prob-
lems, always explicitly initialize your variables after declaration, as demonstrated in
Listing 1-12.
DECLARE @i INT;
SELECT @i = 0; -- Added this statement to initialize @i to 0
SELECT @i = @i + 5;
SELECT @i;
794Xch01final.qxd 3/29/07 4:51 PM Page 13
Summary
This chapter introduced T-SQL. The topics discussed include ANSI SQL:1999 compatibil-
ity in SQL Server 2005 and the difference between imperative and declarative languages.
You also looked at SQL programming style considerations and how they can make your
T-SQL code easy to debug and maintain.
The next chapter provides an overview of the new and improved tools available “out
of the box” for developers. Specifically, Chapter 2 will discuss the SQLCMD replacement
for osql, as well as SQL Server Management Studio, SQL Server 2005 Books Online, and
some of the other tools available for making writing, editing, testing, and debugging eas-
ier and faster than ever.
794Xch01final.qxd 3/29/07 4:51 PM Page 14
794Xch02final.qxd 3/29/07 4:50 PM Page 15
CHAPTER 2
S QL Server 2005 comes with a host of tools and utilities to make development easier.
Some of the most important tools for developers include the following:
This chapter discusses these tools as well as the AdventureWorks sample database,
which I use in the examples in this book. Along the way, this chapter will also cover some
of the SQL Server connectivity features of Visual Studio 2005.
SQLCMD Utility
The SQLCMD utility is an update to the SQL 2000 osql command-line utility. You can use
it to execute batches of T-SQL statements from script files, individual queries or batches
of queries in interactive mode, or individual queries from the command line.
Command-Line Options
You can run SQLCMD from the command line with the following syntax:
15
794Xch02final.qxd 3/29/07 4:50 PM Page 16
The command-line switches are case-sensitive. Table 2-1 lists the SQLCMD
command-line options.
Option Description
-? The -? option displays the SQLCMD help/syntax screen.
Option Description
-f codepage | i:in_codepage The -f option specifies the code pages for input and output. If i: is
[,o:out_codepage] specified, the in_codepage is the input code page. If o: is specified,
out_codepage is the output code page. If i: and o: are not speci-
fied, codepage supplied is the input and output code pages. To
specify code pages, use their numeric identifier. The following
code pages are supported by SQL Server 2005:
Code Page Number Code Page Name
1258 Vietnamese
1257 Baltic
1256 Arabic
1255 Hebrew
1254 Turkish
1253 Greek
1252 Latin1 (ANSI)
1251 Cyrillic
1250 Central European
950 Chinese(Traditional)
949 Korean
936 Chinese (Simplified)
932 Japanese
874 Thai
850 Multilingual (MS-DOS Latin1)
437 MS-DOS U.S. English
-H workstation The -H option sets the workstation name. You can use -H to
differentiate between sessions with commands such as sp_who.
-h headers The -h option specifies the number of rows of data to print before
a new column header is generated. The value must be from –1 (no
headers) to 2147483647. The default value of 0 prints headings
once for each set of results.
-I The -I option sets the connection QUOTED_IDENTIFIER option to ON.
Turning the QUOTED_IDENTIFIER option on makes SQL Server follow
the ANSI SQL-92 rules for quoted identifiers. This option is set to
OFF by default.
-i input_file [,input_file2] The -i option specifies SQLCMD should use files that contain
[,...] batches of T-SQL statements for input. The files are processed in
order from left to right. If any of the files don’t exist, SQLCMD exits
with an error. You can use the GO batch terminator inside your SQL
script files.
Continued
794Xch02final.qxd 3/29/07 4:50 PM Page 18
Option Description
-L [c] The -L option returns a listing of available SQL Server machines on
the network and local computer. If the -Lc format is used, a “clean”
listing is returned without heading information. The listing is
limited to a maximum of 3,000 servers. Note that because of the
way SQL Server broadcasts to gather server information, any
servers that don’t respond in a timely manner will not be included
in the list. You cannot use the -L option with other options.
-l timeout The -l option specifies the login timeout. The timeout value must
be from 0 to 65534. The default value is 8 seconds, and a value of 0
is no timeout (infinite).
-p [1] The -p option prints performance statistics for each result set.
Specifying 1 produces colon-separated output.
-r [0|1] The -r option redirects error message output to the standard error
output device, the monitor by default. If 1 is specified, all error
messages and informational messages are redirected. If 0 or no
number is specified, only error messages with a severity of 11 or
greater are redirected. The redirection does not work with the -o
option; it does work if standard output is redirected with the
Windows command-line redirector (>).
-S server [\instance] The -S option specifies the SQL Server server or named instance
to which SQLCMD should connect. If this option is not specified,
SQLCMD connects to the default SQL Server instance on the local
machine.
Another Random Scribd Document
with Unrelated Content
Bitter sind der Liebe Leiden,
Fürchterlich der Trennung Schmerz;
Doch wer kann die Liebe meiden,
Denn sie kommt von selbst ins Herz.
„Der Mann,“ sagte Antonio, „von welchem der Brief kommt, ist ein
ungemein ordentlicher und sehr reicher Mann, und der, an den der Brief
gehört, ist es nicht minder.“
„Es ist mir genug,“ erwiederte Louise, „daß ich es aus Ihrem Munde
höre; aber ist die Sache deßhalb nicht minder unangenehm? Was denkt
der Mann? Er weiß, er schreibt mir da selbst, daß mein Oheim erst
kommen wird, daß ich folglich allein hier bin, und setzt mir doch nur
vierzig Tage. Wer steht mir gut, daß der Capitän bis dort angekommen
ist? wahrhaftig, eine Verdrießlichkeit um die andere kommt mir über [S
den Hals.“ Nun glaubte Antonio, sein neuliches Versehen ohne die
mindeste Gefahr wieder gut machen zu können, und sprach: „Beste
gnädige Frau, lassen Sie dem Manne seine Grillen, und nehmen Sie die
Zahlung gar nicht an. Sie sagen mir, was Sie beyläufig brauchen, ich bring
es herüber; Sie stellen es mir nach Belieben zurück, und somit gut.“
„Es ist mir wirklich eine große Gefälligkeit,“ sagte Louise, „wenn Sie
mich aus dieser Verlegenheit bringen. Sechs tausend Thaler sind mir
genug.“ „Mit Vergnügen!“ fuhr Antonio fort; „Sie schicken morgen früh
Ihren Mogrobejo, mit einem Paar Zeilen zu mir hinüber, und empfangen
die Summe.“ „Ich bin Ihnen wirklich Dank schuldig,“ sagte Louise,
drückte ihm die Hand, und hieß ihn auf das Zwischenspiel nicht
vergessen. Er ging fort, und so innigst vergnügt sie war, daß er an die
Angel gebissen, so vergnügt war auch er, daß er sein Capital auf so
angenehme Zinsen, wie er hoffte, anlegen konnte. Er wartete den
nächsten Morgen nicht einmahl ab, daß Mogrobejo das Geld [S
abzuhohlen komme, sondern machte es zusammen, und schickte
Leonardo mit seinem Morgengruße und der Summe hinüber, ohne zu
bedenken, wie viel Gefahr das bare Geld in den Händen eines Poeten
laufe. Louise war über seine Pünctlichkeit ganz entzückt, und drückte
Leonardo ein ansehnliches Trinkgeld in die Hand. Auch ließ sie Antonio
melden, daß sie die Vorstellung des Zwischenspiels denselben Abend in
ihrem Hause wünsche; daß sie alle Anstalten dazu treffen werde, und ihn
unausbleiblich zu sehen hoffe. Nun lud sie auch die zwey Mitschwestern
bey ihrer neuen Unternehmung, und ihre Mutter zum Schauspiele. Es war
Abend; der Saal war prächtig beleuchtet, und mit dem angenehmsten
Wohlgeruche durchräuchert, und der Genueser war mitten unter den
Damen so gelagert, daß er bequem mit jeder sprechen konnte.
Es ward Stillschweigen gebothen, und drey Tänzer traten mit
Guitarren auf, und spielten eine sehr artige Sarabande. Als diese zu Ende
war, erschien Leonardo allein, in einer seltsamen Tracht, die er sich [S
selbst aus den buntesten Stücken Stoff zusammen gekünstelt hatte, und
sprach einen Prolog, in dem er den Zuhörern ganz sanft unter die Nase
rieb, daß er der Verfasser sey; daß er dieses Stück Arbeit, ohne zu
prahlen, für eines der witzigsten und originellsten Producte seines Geistes
halte, und daß es den Titel führe: Der Commissarius von Figueras.
DER
COMMISSARIUS VON FIGUERAS.
E I N Z W I S C H E N S P I E L.
ERSTER AUFTRITT.
(Der Commissarius mit einem langen weißen Stabe, einem
schwarzen Unterkleide, einem Mantel darüber, und
einer gefärbten Kräuseschlafhaube. Der Wirth.)
[S. 119]
Commiss. Ja werther Freund, dem Geschäfte hat
Der Richter von Toledo mich gesandt,
Daß ich es schlichten soll mit allem Ernst.
An diesem edlen Hofe strotzen ja
Von Ungeziefer alle Fugen; ich
Bin nun gekommen sie zu reinigen.
Der weise Rath hat mich hierher gesandt
Von Madrits Ufern —
Commiss. Du bist ein Narr, drum ist das Glück dir hold;
Drum hängest du den Schild der Narrheit aus.
Doch sprich, was soll wohl dieser tolle Hut?
Geck. Ach, laßt mir das! nehmt lieber mir das Leben!
(Sie erhält die ihrige, und der zweyte Alguazil tritt mit [S. 126]
einem Poeten, der Bücher ausschreibt, ein.)
Der Wirth. — Seht, da kommt ein andrer Narr.
(Man führt ihn mit gebundenen Händen ab; er scheint [S. 128]
in Begeisterung. Der erste Alguazil führt einen Ritter
ein.)
(Der Held drückt durch stumme Geberden aus, daß er [S. 129]
erwürgt, und mit Füßen ertreten.)
Commiss. Was sprecht ihr nicht?
(Der Held neigt sich sehr tief; der Commissär setzt ihm die
Kappe auf, und der Held geht unter der Begleitung des
Alguazil mit stolzen Schritten ab.)
Der Vorhang fiel, und die ganze Gesellschaft äußerte ihren Beyfall mit
lautem Händeklatschen. Leonardo, dem es gewaltig schmeichelte, zeigte
sich bald, und erntete sein Lob ein. Besonders überhäufte ihn Louise
damit, und alle ersuchten ihn, bald wieder ein kleines Stück zu verfassen,
was er auch mit Mund und Hand versprach. Louise gab jedem
Schauspieler zwanzig Realen, und Antonio lud sie auf den folgenden Tag
zu sich zu Tische.
Louise war diesen Abend so nachsichtig, daß sie selbst über einen
kleinen Schmatz, den er ihr zu rauben wagte, nicht ungehalten war. [S
Um Antonio mit einer angenehmen Gegenunterhaltung zu überraschen,
beschloß die weibliche Gesellschaft, ihm über acht Tage ein kleines Stück
in demselben Saal’ aufzuführen, das sie schon vorlängst einstudiert hatte,
und dessen Vorstellung nur durch den unvermutheten Tod Don
Fernando’s gehindert worden war. Daß sich Louise die Hauptrolle
vorbehielt, versteht sich von selbst. Der Tag der Vorstellung kam; die
Gesellschaft war schon versammelt, und es fehlte nur mehr Antonio, als
plötzlich Leonardo erschien, und Louisen meldete, daß sein Herr von dem
Präsidenten des hohen Rathes in Geschäften Seiner Majestät abgerufen
worden sey, und daß es ihm ungemein leid thue, eine so vortreffliche
Gesellschaft und Unterhaltung entbehren zu müssen, und daß er ihn
deßhalben mit zweyen seiner Freunde geschickt habe, um mit ihnen dem
Schauspiele beyzuwohnen.
Louise bezeigte ihr Mißvergnügen über seine Abwesenheit, und die
Komödie ward aufgeführt. Die Vorstellung war ein Meisterstück von
Lebhaftigkeit: sie waren alle prächtig, und Louise als Mann gekleidet. [S
Mogrobejo übertraf sich selbst an Munterkeit und Witz. Als sie schon alle
wieder ihre vorige Kleidung anhatten, kam Antonio erst vom Präsidenten
zurück, und war äußerst unmuthig, daß er das schöne Schauspiel
versäumet habe, das ihm Leonardo und seine Freunde so reitzend
schilderten. Nur Louise hatte ihr Mannskleid noch nicht abgelegt, um ihn
an der Thür zu überraschen. Es ließ ihr so wunderschön, daß Antonio den
holden Knaben nicht genug angaffen konnte. Louise bedauerte sehr, daß
sie ihn vermißt habe, und gab ihm endlich ihr Wort, daß sie ihm wieder
über acht Tage, in der Quinta des Connetable, ein anderes Stück geben
wolle; nun treffe aber wieder ihn die Reihe, das Fest anzuordnen. Sie
wußte wohl, daß er sich prächtig einstellen werde, und er nahm auch den
Befehl mit Freuden an. Sie würden dann alle bey ihm ein kleines
Abendschmäuschen halten, sagte er, und sie solle ihm nur auf einem
kleinen Zettel anmerken, was sie zum Schauspiele vonnöthen habe. Er er
hielt bey dem Besuche am nächsten Abend’ ein vollständiges [S
Verzeichnis von Kleidungsstücken von sechs Personen: das Stück, das
Mogrobejo in der Eile verfaßte, spielte in der Heldenzeit, und die
Personen waren alle Prinzen und Prinzessinnen. Louise spielte einen
jungen Helden, dem die Sclaven eine reiche Beute nachtragen. Am Ende
des Zettels waren Federn, Ringe und falscher Schmuck nur hingeworfen.
Louise hatte vorsetzlich falscher Schmuck geschrieben, weil sie gar nicht
zweifelte, daß er wenigstens für ihre Person echten ausborgen würde.
Antonio mußte freylich täglich vor dem Rath’ erscheinen; indessen war
doch aller Anschein, daß er denselben Tag würde los kommen können,
und ließ denn den Saal, Erfrischungen, Abendschmäuschen, nebst allem
übrigen, was zum Feste gehört, bereit halten.
Zwey Tage vor dem, der zum Schauspiele bestimmt war, schickte der
Genueser die ganze Guarderobe. Louise hatte vermuthet, daß er
höchstens die schönsten Kleider, die man allenfalls bey einem Trödler [S
bekäme, ausborgen würde; er hatte aber zu ihrer allen größtem
Erstaunen alles ganz neu verfertigen lassen. Alles war von Atlaß,
Sammet, Taffet, oder anderem Seidenstoffe, und reich mit Gold und
Silber verbrämt. Federn, Schnällchen, Blumen, Ketten und Ringe waren in
Überfluß, und für Louisen versprach er den Schmuck, der sie zieren sollte,
des Abends selbst mitzubringen. Er brachte auch wirklich den Schmuck
mit, den ihm seine selige Gattinn hinterlassen hatte, und erklärte mit
einem bedeutungsvollen Lächeln, daß er ungemein neugierig sey, wie
Louisen dieser Schmuck seiner seligen Frau passen werde. Louise
überhäufte ihn diesen Tag mit so vielen Liebkosungen, und wußt’ ihm
dabey doch so sittsam zu schmeicheln, daß er seiner Hoffnung immer
freyeren Spielraum ließ. Zwischen den zwey Tagen, bis zur Aufführung
des Schauspiels, war unsere Gesellschaft gar nicht müßig, und Theodore
machte Anstalt, daß in den beyden Nächten alles, was von Bedeutung im
Hause wäre, aufgeräumt, und anders wohin in Sicherheit gebracht [S
würde. Der Tag des Schauspiels erschien; Antonio’s Bediente waren
schon in der Quinta, und bereiteten alles. Der Genueser war, um Zeit zu
gewinnen, auf einem Maule in den Rath geritten. Theodora, ihre Töchter,
Banuelos und Mogrobejo setzten sich in ihre Kutsche, nahmen allen
Schmuck, und die ganze Guarderobe mit sich, und fuhren, anstatt zu
Alcalathore hinaus, in ein kleines Häuschen, in Quartiere Santa Barbara,
das Mogrobejo vorläufig gemiethet hatte. Hier nahmen sie augenblicklich
andere Kleider; Mogrobejo führte den Wagen zu einem Sattler, um sein
Äußeres so geschwind’ als möglich ändern zu lassen. Die Pferde wurden
auch heimlich untergebracht; und um noch sicherer zu seyn, theilte sich
unsere Gesellschaft in die ursprünglichen zwey Parteyen; die eine begab
sich nach Illescas, und die andere nach Valdemoro. Sobald unser
Genueser von dem Rath’ abgefertigt war, trappte er frohes Muthes, und
in den schönsten Aussichten von der Welt, der Quinta zu. Er fand
niemanden, als seine Bedienten, und die drey Köche, die er bestellt [S
hatte, fragte nach den Damen, und als er hörte, daß sie noch nicht da
wären, war er sehr unruhig; denn er dachte nichts anderes, als daß ihnen
irgend ein Unglück begegnet seyn dürfte. Er stieg denn wieder auf seinen
Maulesel, stieß ihm mit den Knien fleißig in die Lenden, und kam sehr
geschwinde bey Louisens Haus’ an. Er fand die Wohnung gesperrt,
erkundigte sich bey den Nachbarn, und vernahm, daß die ganze Familie
schon abgefahren sey. Er kam nun auf den Gedanken, daß sie ihre
Freundinnen abgehohlt haben würden, und so blieb ihm nichts übrig, als
in der größten Verlegenheit, daß nun er vielleicht auf sich warten ließe,
nach der Quinta zurück zu eilen. Er fand aber noch niemanden, und
wußte nun nicht, was er von diesem langen Ausbleiben denken sollte. Er
wartete bis neun Uhr in der peinlichsten Ungeduld, und es war noch
niemand zu sehen und zu hören. Endlich trat ein Bedienter ein, und gab
Antonio einen Brief, den ihm, wie er sagte, am Thor’ ein Unbekannter [S
gegeben habe. Er brach ihn zitternd auf, und las:
„Bester Antonio, seyn Sie nicht bekümmert, daß Sie Ihre
Nachbarinnen nicht finden; sie sind an einem Orte, wo man sie unmöglich
finden kann. So viel für jetzt.“
Der Genueser stand da, wie vom Donner gerührt; er gerieth endlich in
fürchterliche Wuth, und schwor allen, wenn sie ihn betrogen hätten, Tod
und Verderben. Seine Bedienten mußten ihn wie einen Tieger bändigen,
brachten ihn in den Wagen, und führten ihn nach Madrit. Auf dem Wege
besänftigte er sich wieder etwas, und schloß aus den letzten Worten des
Briefes: „So viel für jetzt,“ daß es vielleicht nur ein Scherz sey, und daß
sie ihn vielleicht in seinem Hause erwarteten; er war aber nur zu bald
vom Gegenteile überzeugt. Louisens Wohnung war auch noch versperrt,
und er wartete nun am Hausthore bis lange nach Mitternacht, ob er ihre
Ankunft nicht erwarten könnte; aber niemand kam. Er schlief die ganze
Nacht nicht eine Secunde, und ließ sich mit Tages Anbruche bey Louisens
Hausherrn, der noch im Bette lag, melden. Von diesem vernahm er [S
denn, daß ihm Louise Tages zuvor die Schlüssel der Wohnung zurück
gestellt, und ihm gesagt habe, daß sie sich Geschäfte halber nach Toledo
begeben habe.
„Sie hat Ihnen aber ja die tausend Reale bezahlt,“ sagte Antonio.
„Was für Reale?“
„Die Jahresmiethe für die Wohnung.“
„Die Jahresmiethe? Die Wohnung war ja nur auf zwey Monathe
gemiethet.“
„Wie sagen Sie?“ schrie Antonio, und war im ganzen Antlitze
scharlachroth.
„Ich bin aber auch für diese zwey Monathe nicht bezahlt,“ sagte der
Hausherr, „und Sie werden belieben, mich zu bezahlen.“
„Wer? Ich?“ schrie Antonio, und erstickte beynahe vor Wuth.
„Ja, Sie,“ sagte der Hausherr; „Sie werden doch nicht läugnen, daß
die Dame bey Ihnen Gelder stehen hat; daß dieß hier Ihre schriftliche
Anweisung ist?“
„Diebe! Mörder!“ schrie Antonio, und packte den Hausherrn bey der
Brust, faßte sich aber doch gleich wieder, und sagte: „Vergeben Sie [S
einem unglücklichen Manne, den man zum Bettler gemacht hat. Man hat
Sie betrogen, wie mich. O ich Thor! ich Rasender! ich Narr! ich alter
Sünder,“ — bey jedem dieser Titel schlug er sich mit geballter Faust vor
die Stirn — „nun bin ich ein Bettler, bin auf ewig unglücklich.“
So weit war es eben nicht gekommen; indessen hatte ihn die schöne
Wittwe, die nun wieder Jungfrau geworden war, nebst den sechs tausend
Thalern, die ihr Grimaldi angewiesen hatte, um mehr als zwölf tausend
Escudo’s geprellt. Der arme Antonio eilte zu dem Richter, schickte die
Alguazils nach allen zwey und dreyßig Winden aus; aber alles
Nachsuchen war vergebens. Nach acht Tagen hatte man noch nicht die
geringste Spur, und nun erhielt er, um ihn vollkommen zu Verzweiflung zu
treiben, die Nachricht, daß sein einziger Sohn zu Genua auf den Tod läge,
und ihn um den letzten väterlichen Segen bitte. Er reiste denn mit dem
festen Vorsatz’ ab, nach seines Sohnes Tod’ oder Genesung eine [S
kleine Reise durch die ganze Welt zu machen, um die Schlange irgend wo
zu finden und zu zertreten.
DRITTE SPAZIERFAHRT.
Dorothee, welche nun die Reihe traf, ließ vier Monathe verstreichen,
bevor sie eine neue Unternehmung wagte, damit sich unterdessen das
Gerücht vom Kapellenbaue verlieren möchte. Auch benützte man diese
Zeit, um den Wagen wieder anders zuzurichten, und Kutscher und Pferde[S
zu wechseln. Endlich fand sie es räthlich, in Gesellschaft ihrer Mutter, und
der alten Banuelos zu Madrid einzuziehen. Sie nahmen ihre Wohnung
dieß Mahl zur Abwechslung in dem Martinsviertel. Nach einigen Tagen
begaben sie sich mit dem neuen Escudero, den sie aufgenommen hatten,
unter das Thor von Quadalaxara. Als die jungen Herren, die auf dem
Markte herum spazierten, einen Damenwagen an einem
Kaufmannsgewölbe halten sahen, liefen sie wie Hasen davon, um nicht
etwa in die Verlegenheit zu gerathen, wenn es eine von ihren Bekannten
wäre, aus Artigkeit oder Tändeley ein Geschenk anbiethen zu müssen.
Dorothee ließ sich eine goldener Tabatiere, und etwas von Frauenputz an
den Wagenschlag bringen. Mit einem Mahle kam ein fremder Cavalier, der
erst unlängst aus Andalusien angekommen war, und nun hier den
Zusammenfluß der Madriter schauen wollte, an dem Wagen vorüber. Die
schöne Dorothee fiel ihm auf, und als ein Mann von Welt, machte er ihr
sogleich seine tiefe Verbeugung. Er mochte beyläufig sechs und zwanzig[S
Jahre haben, war klein von Person, aber niedlich gebaut, und ganz fertig,
ein Gespräch mit feinen Wendungen und drolligen Einfällen zu würzen;
dabey war er aber von ungemein verliebter Stimmung, und sein Kopf war
vom Romanenlesen ein wenig angebrannt. Dorothee bemerkte den
raschen Eindruck, den sie auf ihn gemacht habe, und begegnete seinem
Blicke vorsetzlich einige Mahl. Er ward muthiger, trat an den
Wagenschlag, und sagte: „Schöne Unbekannte, diese Waare ist schon
bestellet.“ „Das thut mit leid,“ antwortete Dorothee. „Indessen,“ fuhr der
Andalusier fort, „wenn sie Ihnen gefällt, bin ich bereit, sie mir abhandeln
zu lassen, und will sie als förmlicher Kaufmann in Ihre Wohnung bringen,
die Sie mir zu sagen belieben werden.“ Hiermit steckte er dem Kaufmann,
was die Waare beyläufig werth seyn mochte, in die Hand.
„In der That,“ sagte Dorothee, „wenn ich Sie kennte, würde ich Ihnen
vielleicht mit eben dieser — wie will ich sagen — Freymüthigkeit, oder [S
Zudringlichkeit, wenn Sie wollen, in Ihren Ton einstimmen; so aber“ — sie
hatte sehr gut gesehen, was vorgegangen war — „bleibt mir nichts übrig,
als die Waare wieder dahin zurück zu stellen, von wo ich sie bekommen
habe. Gnädiges Fräulein,“ sagte er, „denn Frau können Sie doch
unmöglich seyn; Sie scheinen ungehalten: seyn Sie es aber nicht. Ich bin
ein Mensch, der niemand auf Erden, am wenigsten aber eine Dame
beleidigen will, und der nur manchmahl den Rechnungsfehler begeht, daß
er meint, man würde seine — ich kann es mit gutem Gewissen nur
Lebhaftigkeit nennen, eben so gerade aufnehmen, als er sie äußert. Bey
uns in Andalusien wird mir so etwas zu Gute gehalten; ich erwartete
denn, daß ich hier, wo ich erst zwey Tage bin, ein anderes Andalusien
finden werde.“
Dorothee merkte nun, daß sie ihren Mann gefunden habe, und fand
es für gut, an der Stelle eine nähere Bekanntschaft zu gründen. Sie frage
denn: „Mein Herr, das ganze Waarenlager werden Sie doch nicht
aufgekauft haben,“ stieg aus dem Wagen, und ging in das Gewölbe; [S
Der Andalusier ihr nach.
Sie ließ sich Federn, Bänder, und Seidenstoff für beyläufig hundert
Escudo’s vorlegen, und behandelte den Preis. Sie bemerkte, daß er vom
Kaufmanne heimlich die Rechnung fordre, und sagte daher: „Mein lieber
Herr, ich habe vor Tische noch einige Besuche vor mir: Sie würden mich
verbinden, wenn Sie mir alles nach Tische in meine Wohnung schickten;
dann werden Sie auch gleich das Geld dafür erhalten.“ Der Kaufmann
fand sich sehr bereit, und Dorothee sagte ihm ihre Wohnung. Der
Andalusier sprach nur: „Gnädiges Fräulein, ich weiß nun Ihre Wohnung:
wie würden Sie sich wohl benehmen, wenn ich unartig genug wäre, Sie
zu besuchen?“ „Fürs erste,“ antwortete Dorothee, „halt’ ich Sie nicht für
so voreilig; und wenn Sie es wären, würde mir nichts übrig bleiben, als
daß ich durch ein artiges Betragen Sie zu bessern suchte.“ Sie ging fort,
und fuhr nach Hause. Nach Tische kam der Diener des Kaufmanns,
brachte die Waaren, und als sie sich anstellte, als ob sie bezahlen [S
wollte, schlug er es unter dem Vorwande aus, daß die Summe noch zu
klein wäre, um eine Rechnung zu machen, und daß sie ihr noch mehr zu
verkaufen dächten. Es währte nicht lange, so war auch unser Andalusier
da. Dorothee empfing ihn in Gesellschaft ihrer Duennen sehr artig, und er
erzählte ihr, daß er Don Thadeo de Sylva heiße, eigentlich aber Don
Thadeo Tristan de Lorgenes, nach einem Oheime, der das
Abgeschmackte dieses Nahmens mit einer ansehnlichen Erbschaft wieder
gut gemacht hätte; Dorothee vertraute ihm dafür, daß sie mit einem
Ritter verheirathet sey, der sich in Indien befände, und so unglücklich
gewesen sey, in Lima gefangen zu werden; nun erwarte sie aber ihn und
ihr ganzes Vermögen mit der nächsten Flotte. Don Thadeo both ihr
feyerlich alle Dienste an, die in seinen Kräften ständen, indem er wohl
wisse, was sich für Schwierigkeiten fänden, wenn man am Hofe
Forderungen machte. „Es ist wahr,“ erwiederte sie; „aber zum Glücke hab’
ich doch immer genug gehabt, um zwey Dienerinnen, einen Escudero, [S
und meinen Wagen zu halten.“ Nun war es Zeit, sich zu entfernen, und
Thadeo empfahl sich.
Dorothee suchte nun nähere Erkundigung über seine Umstände
einzuziehen, und alle Nachrichten waren nach Wunsche. Seine Besuche
wurden immer häufiger, und seine Neigung immer heftiger. Dorothee
suchte seine Schwächen aufzufinden, unter denen auch die Vorliebe für
Lieder und Melodien, die er selbst verfaßt hatte, war, und suchte sie auf’s
Beste zu benutzen; kurz, er ward so verliebt, als noch kein Liebhaber
ihrer Mitschwesterchen gewesen war. Dorothee, die eine sehr schöne
Stimme, und einen hinreißenden Vortrag hatte, sang von der Stunde an
kein Liedchen mehr, das nicht Thadeo verfertigt hatte, und verlangte
selbst noch Unterricht auf der Guitarre von ihm; dafür liefen sich seine
Bedienten mit Küchengeschenken müde, und er selbst brachte beynahe
jeden Tag irgend eine kostbare Kleinigkeit zum Putze mit. Dorothee hatte
jedes Mahl einen Vorwand bereit, unter dem es ihre Bescheidenheit [S
erlaubte, seine Großmuth nicht zurück zu schrecken. Auch hatte sie sich
schon zwey Mahl einen Kuß auf die Lippen gefallen lassen, von denen sie
den letzten sogar — wer hätte sich’s von Donna Dorothea träumen
lassen? — mit schamhaftem Erröthen erwiederte.
Den folgenden Tag kam Thadeo nicht, und Dorothee war in sichtbarer
Unruhe: sie konnte sein Außenbleiben nur mit der strengen Witterung
entschuldigen; denn es war mitten im Winter. Sie hatte sich auch nicht
getäuscht; denn er kam den andern Tag: indessen war es ihr doch ein
Fingerzeig, daß sie ihn noch nicht genug in Bewegung gesetzt habe. Sie
suchte daher alles Mögliche hervor, was einen Mann fest halten kann: sie
schmollte; sie bezeigte ihm bey jeder Gelegenheit Aufmerksamkeit, und
es gelang ihr auch, ihn bald so zu kirren, daß er mit Leib und Seele an ihr
hing, und nun weiter nichts mehr fehlte, als eine gute Gelegenheit, um
sein Vertrauen und seine Liebe so ergiebig als möglich zu benutzen.
Während Dorothee in Illescas wohnte, war ein Student aus Toledo
dort angekommen. Er hieß Don Basil, war ein erzarmer Teufel, [S
übrigens aber so schön und wacker gebildet, und so aufgeweckten
Geistes, daß Dorotheens Standhaftigkeit selbst so vielen Reitzen nicht
widerstehen konnte. Sie wurden bald bekannt, noch geschwinder
vertraut, und es war bald so weit gekommen, daß sie ihm sogar
gestattete, ihr nach Madrit zu folgen, unter dem Bedingniß’ aber, daß er
ihre Unternehmungen nicht im geringsten stören sollte. Er ging es darauf
ein, und lebte denn auch in Madrit in dem besten Einverständnisse mit
ihr, ohne sich von Eifersucht plagen zu lassen. Alles wäre gut gegangen;
nur wollte sich noch keine besonders vortheilhafte Gelegenheit zeigen.
Endlich traf es sich, daß einer von Thadeo’s Freunden heirathete.
Thadeo sagte Dorotheen, daß die Vermählung bey San Sebastian mit
einer seltnen Pracht gehalten werden würde, und daß er selbst in einem
Glanze erscheinen werde, in dem sie ihn noch nie gesehen habe. „Wenn
ich in der Kirche erscheinen soll,“ sagte Dorothee, „so verlange ich ohne
dieß, daß mein lieber Thadeo die übrige Gesellschaft übertreffe. Wenn [S
Sie mir aber dann gefallen, bin ich nicht zufrieden, Sie nur in der Kirche
bewundern zu können; ich will Sie bey mir im Hause haben. Sie werden
sich doch gewiß um eilf Uhr vom Spiele los machen können; und bis
dahin will ich mit dem Abendessen auf Sie warten.“
Thadeo sagte es ihr heilig zu, und so schieden sie aus einander. Die
Vermählung ging vor sich, und Dorothee erstaunte über die Pracht ihres
Geliebten. Er war im prächtigsten Stoffe gekleidet, und schien alle
Juweliere von Madrit ausgekauft zu haben. Knöpfe, Ketten, Agraffen,
Ringe, alles war von Brillanten. Er kam auch um eilf Uhr des Abends voll
Vergnügen zu Dorotheen, und erzählte ihr, daß er so glücklich gewesen
sey, gegen zwey tausend Escudo’s zu gewinnen. Sie speisten; es wurde
immer später; Dorothee war ungemein gefällig, und sagte endlich, daß
sie ihn heute nicht mehr nach Hause lasse: denn wenn irgend ein
Schurke seinen Schmuck gewahr würde, könnte er ein Unglück haben.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com