This tab will display an area for you to save the extracted Showplan events to either a single .SQLPlan file or separate .SQLPlan files for each event.. When the trace is run, you can se
Trang 1A p p e n d i x : S Q L P r o f i l e r 4 9 9
displayed on the Trace Properties dialog This tab will display an area for you to save
the extracted Showplan events to either a single SQLPlan file or separate SQLPlan
files for each event
When the trace is run, you can select the Showplan items from the upper portion
of the trace window to display the query plan diagram in the lower portion of the
window Figure A-5 shows a query plan diagram
Figure A-5 Query plan diagram
Trang 2This page intentionally left blank
Trang 3501
References to figures are in italics.
A
administrative tools, 14
ADO, 258–260
adding the ADO reference to Visual
Basic, 263–264 architecture, 260–262
batch updates, 320–321
closing a Recordset, 289–290
Command object, 301–305, 312–318
Connection object, 305–307
connecting to SQL Server, 265–281
connecting to SQL Server using a UDL
file, 276–277 connecting to SQL Server using the
Data Link dialog, 277–281 connection string keywords, 266
data bound Recordsets, 295–298
error handling, 318–320
finding and bookmarking rows, 298–301
forward-only Recordset object,
283–289 keyset Recordset object, 290–295
modifying data with, 307–316
MSDASQL prompt constants, 269
and OLE DB, 260
opening a connection using the
Connection object’s properties, 274–276
opening a connection with OLE DB
Provider for ODBC, 265–270 opening a connection with OLE DB
Provider for SQL Server, 271–273
opening a DSN-less connection with OLE DB Provider for ODBC, 270–271
opening a trusted connection using OLE DB Provider for SQL Server, 273–274
overview, 262–263 Recordset object, 281–305, 308–312 transactions, 322–324
types of cursors, 281–282 ADOMD.NET, 418
adding references, 422–423 AdomdCommand object, 427–434 AdomdConnection object, 423–426 AdomdDataAdapter object, 434–435 AdomdDataReader object, 427–430 building BI applications with, 421–436
CellSet object, 432–434 connection string keywords, 425–426 CubeDef object, 436
object model, 419–421 XMLReader object, 431–432 ADO.NET
architecture, 170–172, 173
core classes in System.Data, 177–182
namespaces, 172 NET Data Providers, 172–177 aggregates, CLR, 105–110
Analysis Management Objects (AMO), 417–418
hierarchy, 418–419 Analysis Server Scripts projects, 9
Copyright © 2006 by The McGraw-Hill Companies Click here for terms of use
Trang 45 0 2 M i c r o s o f t S Q L S e r v e r 2 0 0 5 D e v e l o p e r ’s G u i d e
Analysis Services
databases, 17
overview, 416–421
projects, 17–18
application definition files (ADFs), 140–141,
144–152
AS keyword, 51–52
assemblies, 78, 80, 81–82
assisted editors, 14
asymmetric keys, 47–48
asynchronous query support, 209–210
B
BI Development Studio See Business
Intelligence (BI) Development Studio
BLOB data, retrieving, 212–215
BULK INSERT statements, 68–69
Business Intelligence (BI) Development
Studio, 14–16
Designer window, 16
Output window, 20
Properties window, 20
Solution Explorer window, 16–20
Toolbox window, 20
C
certificates, 48
CLR, 78
aggregates, 105–110
architecture, 79–80
creating database objects, 82–110
database object components, 80–83
debugging database objects, 110–115
enabling support, 80
stored procedures, 83–90
system views, 115
triggers, 94–98
user-defined functions (UDFs), 90–94
user-defined types (UDTs), 99–105
clustered indexes, 39
CommandBuilder, 216–220
Common Language Runtime See CLR
common table expressions (CTEs), 62–64
Connect To Server dialog box, 7
connection pooling, 187–189 constraints, 36–37
CREATE DATABASE statement, 35 credentials, 46
Cube Wizard, 18 cursors, 60–62 dynamic, 283 forward-only, 283 keyset, 283 static, 283
D
Data Mining Designer, 18 data source views, 18 Data Transformation Pipeline (DTP), 375–376
Data Transformation Runtime (DTR), 376–377
data types, 37–38 Database Tuning Advisor, 14 databases, 35
DataReader, 204–215 DDL triggers, 45 debugging, CLR database objects, 110–115 defaults, 40
DELETE statements, 71–72 Dimension Wizard, 18 DML
modifying data with, 65–74 querying and updating with T-SQL DML, 49–75
dynamic SQL, executing with the ADO Connection object, 305–307
dynamic SQL statements, executing, 191–193
E
error handling ADO, 318–320 CLR, 74–75 SMO, 474–475
Trang 5I n d e x 5 0 3
F
FLWR (For-Let-Where-Return) statements,
230–231
full-text catalogs, 49
full-text searching, 48–49
functions, 43–45
G
Generate SQL Server Scripts Wizard, 5, 7, 8
GROUP BY clause, 53–54
H
HTTP SOAP
creating SOAP endpoints, 247–249
using SOAP endpoints, 249–253
I
Import Analysis Service 9.0 Database, 19
indexed views, 39
indexes, 38–40
INSERT statements, 65–68
instance configuration files (ICFs), 140–144
INSTEAD OF triggers, 72
Integration Services
APIs, 404–412
breakpoints, 395–397
checkpoints, 397–398
creating configurations, 400–403
Data Transformation Pipeline (DTP),
375–376
Data Transformation Runtime (DTR),
376–377
deploying packages, 399–404
overview, 374–375
Package Deployment Utility, 403–404
package security, 399
projects, 18
SSIS Designer, 18–19, 378–395
SSIS Import and Export Wizard,
377–378
transactions, 398
J
joins, retrieving related data using, 56–58
L
logins, 46
M
Management Studio See SSMS
master keys, 47 Microsoft Full-Text Engine for SQL Server (MSFTESQL), 48–49
multiple active result sets (MARS), 210–211
N
.NET Data Providers, 81, 172 adding the System.Data.SqlClient namespace, 182–183
connection string keywords, 184–186, 189–190
core classes, 175–177 namespaces, 173–174 NET database object security, 112–115 nonclustered indexes, 39
Notification Services application definition files (ADFs), 140–141, 144–152
building a NET subscription/event application, 158–166
building applications using nscontrol, 155–157
building applications using SSMS, 153–155
compiling applications, 139 defining applications, 139 events, 136–138
firing data events using NET, 163–166 firing data events using T-SQL, 166 instance configuration files (ICFs), 140–144
notification engine, 138–139 notifications, 138
Trang 65 0 4 M i c r o s o f t S Q L S e r v e r 2 0 0 5 D e v e l o p e r ’s G u i d e
Notification Services (Cont.)
overview, 136
sample application, 140–157
subscriptions, 138, 159–163
updating applications, 157
nscontrol, building Notification Services
applications using, 155–157
O
Object Explorer window, 5–8
OLE DB, 256
and ADO, 260
architecture, 256–258
OLE DB Provider for ODBC
provider-specific keywords, 267–268 OLE DB Provider for SQL Server
connection string keywords, 272 ORDER BY clause, 53
output, 73–74
Output window, 20
P
parameterized queries, 368–369
parameterized SQL statements, executing,
193–196
PIVOT operator, 64–65
prepared SQL, 301–305
Profiler, 14
Properties window
BI Development Studio, 20
SSMS, 10–11
Q
Query Analyzer See Query Editor
Query Builder, 24–26
parameterized queries, 368–369
Query Editor, 11–13, 22–24
R
Registered Servers window, 4–5
Report Definition Language (RDL), 362
Report Model Project template, 20 Report Project template, 19 Report Project Wizard, 19–20 Reporting Services
accessing reports, 362–363 architecture, 326–327 authoring tools, 328, 348–358 command-line installation options, 331 components, 327–329
configuration and management tools,
328, 341–347 configuration tool, 342–344 creating a report, 364–369 deploying reports, 369 development stages, 363–364 embedding a browser control on
a Windows form, 360 extensions, 338–340, 361–362 installing, 329–336
parameterized queries, 368–369 parameters used with ADDLOCAL and REMOVE properties, 335
programmability, 329, 359–362 report authoring, 363–371 Report Builder, 357–358 Report Designer, 348–353 Report Manager, 328, 340–341 Report Model Designer, 353–356 Report Processor, 337–338 Report Server, 328, 336–340 Report Wizard, 348–350
rs utility, 344–345, 346 rsconfig utility, 344, 345 rskeymgmt utility, 345–347 running reports, 369–371 Scheduling and Delivery Processor, 338 Setup ini file options, 332–334 starting Internet Explorer from
a Windows form, 359–360 using SOAP, 361
Results window, 13 roles, 47
rules, 40
Trang 7I n d e x 5 0 5
S
scalar-valued functions, 43–44
schemas, 47
scripts, generating, 5–7
searching, 48–49
security, 46–48
CLR, 112–115
opening a trusted connection, 186–187
SSIS packages, 399
SELECT DISTINCT statement, eliminating
duplicate rows with, 54–55
SELECT INTO statement, creating tables
using, 55
SELECT statements, 49
building queries using, 50–51
filtering using the WHERE clause,
51, 52
grouping results with GROUP BY,
53–54
ordering results with ORDER BY, 53
renaming columns with AS, 51–52
using the TOP clause, 56
server types, 6
Service Broker
activation, 131–132
Adjacent Broker Protocol, 121
architecture, 118–121
contracts, 120
creating objects, 126–127
Dialog Protocol, 121
dialog security, 132
dialogs, 120–121
enabling, 122–124
message transport protocol, 121
messages, 119
new T-SQL commands, 122, 123
queues, 120
retrieving messages from a queue,
130–131
sample application, 125–131
sending messages to a queue, 127–129
services, 120
system views, 132–133 using queues, 124–125 SMO, 440–441
adding SMO objects to Visual Studio, 441–442
connecting to the selected SQL Server system, 461–463
creating databases, 468–469 creating the Server object, 442–444 Database object hierarchy, 453–456 error handling, 474–475
getting property values, 444 hierarchy, 449
instance classes, 452 JobServer object hierarchy, 457–459 listing columns, 465–466
listing databases, 463–464 listing registered SQL systems, 461 listing tables, 464–465
namespaces, 450 property collections, 445–449 retrieving column attributes, 467–468 sample application, 459–475
Server object hierarchy, 452–453 setting property values, 445 showing T-SQL script for tables, 472–474
Table and View object hierarchy, 456–457
transferring tables, 469–472 utility classes, 450–451 Solution Explorer window
BI Development Studio, 16–20 SSMS, 8–10
SQL Management Objects See SMO
SQL Mobile Scripts projects, 10 SQL Profiler, 492
predefined templates, 494 replaying a trace, 497 Showplan events, 497–499 starting, 492–496
starting, pausing, and stopping a trace, 496–497
Trang 85 0 6 M i c r o s o f t S Q L S e r v e r 2 0 0 5 D e v e l o p e r ’s G u i d e
SQL Server Management Studio See SSMS
SQL Server Scripts projects, 9
SqlAdapter object, 215–220
Sqlcmd utility, 478
command shell, 478–479
command-line parameters, 479–483
developing scripts with Query Editor,
485–487 extended commands, 484
nesting scripts, 488
variables, 484–485, 487–488, 489
SqlCommand object, 190–200
SqlConnection object, 183–190
SqlDataReader object, 204–215
SqlDependency object, 201–204
SSIS See Integration Services
SSMS
building Notification Services
applications, 153–155 Object Explorer window, 5–8
overview, 2–3
Properties window, 10–11
Query Builder, 24–26
Query Editor, 11–13, 22–24
Registered Servers window, 4–5
Results window, 13
Solution Explorer window, 8–10
as T-SQL development tool, 22–27
user interface, 3–4
using projects, 26–27
version control, 27
static SQL, 301–305
storage for searching, 48–49
stored procedures, 41–43
CLR, 83–90
deploying, 89–90
executing with Command objects,
316–318 executing with return values, 196–198
extended, 83–84
setting security, 89
using, 90
subqueries, 59–60
Summary Page, 7–8
symmetric keys, 48 synonyms, 41 system views CLR, 115 Service Broker, 132–133 System.Data
Constraint, 181 DataColumn, 179–180 DataException, 182 DataRelation, 181 DataRow, 180
DataSet, 178, 179
DataTable, 178–179 DataView, 180 DataViewManager, 180 ForeignKeyConstraint, 181 UniqueConstraint, 181
T
tables, 36–43 table-valued functions, 44–45 temporary tables, 37
Toolbox window, 20 TOP clause, 56 transactions, 73 ADO, 322–324 executing, 198–200 Integration Services, 398 triggers, 45
CLR, 94–98 trusted connections, 186–187 Try-Catch, 74–75
T-SQL creating database objects using T-SQL DDL, 34–49
development tools, 22–34 executing and debugging with Visual Studio 2005, 33–34
firing data events using, 166 querying and updating with T-SQL DML, 49–75
using Sqlcmd variables and T-SQL statements, 489
Trang 9I n d e x 5 0 7
U
UNION statements, combining related data
using, 58–59
unique indexes, 39
Universal Data Link (UDL) files, 276–277
UNPIVOT operator, 64–65
UPDATE statements, 70–71
user-defined aggregates, 105–110
user-defined functions (UDFs), 90–94
user-defined types (UDTs), CLR, 99–105
users, 46–47
V
version control, 12–13, 27
views, 40–41
Visual SourceSafe, 12, 27
Visual Studio 2005, 27–32
executing and debugging T-SQL with,
33–34
W
Web services, 250–253
WHERE clause, 51, 52
WSDL, 250
X
XML bulk-loading XML documents, 245–246
data type, 222–227 Exist method, 231–232 indexes, 40, 235–236 Modify method, 232–233 nested For XML queries, 242 OPENXML keyword, 244–245 Query method, 233–234 Value method, 234 For XML Auto mode, 237 For XML Explicit mode, 237–239 For XML Path mode, 240–241 For XML Raw mode, 236 For XML Type mode, 239–240 XSD schema generation, 242–244
See also HTTP SOAP
XMLA protocol, 416, 417 XQuery, 227–231 XSD schemas data validation using, 223–227 inline XSD schema generation, 242–244