Which statement should you execute?
###BeginCaseStudy###
Case Study: 5
Litware, Inc
Overview
General Overview
You are a database developer for a company named Litware, Inc. Litware has a main office in
Miami.
Litware has a job posting web application named WebApp1. WebApp1 uses a database
named DB1. DB1 is hosted on a server named Server1. The database design of DB1 is shown
in the exhibit. (Click the Exhibit button.)
WebApp1 allows a user to log on as a job poster or a job seeker. Candidates can search for
job openings based on keywords, apply to an opening, view their application, and load their
resume in Microsoft Word format. Companies can add a job opening, view the list of
candidates who applied to an opening, and mark an application as denied.
Users and Roles
DB1 has five database users named Company, CompanyWeb, Candidate, CandidateWeb, and
Administrator.
DB1 has three user-defined database roles. The roles are configured as shown in the
following table.
Keyword Search
The keyword searches for the job openings are performed by using the following stored
procedure named usp_GetOpenings:
Opening Update
Updates to the Openings table are performed by using the following stored procedure named
usp_UpdateOpening:
Problems and Reported Issues
Concurrency Problems
You discover that deadlocks frequently occur.
You identify that a stored procedure named usp_AcceptCandidate and a stored procedure
named usp_UpdateCandidate generate deadlocks. The following is the code for
usp_AcceptCandidate:
Salary Query Issues
Users report that when they perform a search for job openings without specifying a minimum
salary, only job openings that specify a minimum salary are displayed.
Log File Growth Issues
The current log file for DB1 grows constantly. The log file fails to shrink even when the daily
SQL Server Agent Shrink Database task runs.
Performance Issues
You discover that a stored procedure named usp_ExportOpenings takes a long time to run
and executes a table scan when it runs.
You also discover that the usp_GetOpenings stored procedure takes a long time to run and
that the non-clustered index on the Description column is not being used.
Page Split Issues
On DB1, many page splits per second spike every few minutes.
Requirements
Security and Application Requirements
Litware identifies the following security and application requirements:
• Only the Administrator, Company, and CompanyWeb database users must be able to
execute the usp_UpdateOpening stored procedure.
• Changes made to the database must not affect WebApp1.
Locking Requirements
Litware identifies the following locking requirements:
• The usp_GetOpenings stored procedure must not be blocked by the
usp_UpdateOpening stored procedure.
• If a row is locked in the Openings table, usp_GetOpenings must retrieve the latest
version of the row, even if the row was not committed yet.
Integration Requirements
Litware exports its job openings to an external company as XML data. The XML data uses
the following format:
A stored procedure named usp_ExportOpenings will be used to generate the XML data. The
following is the code for usp_ExportOpenings:
The stored procedure will be executed by a SQL Server Integration Services (SSIS) package
named Package1.
The XML data will be written to a secured folder named Folder1. Only a dedicated Active
Directory account named Account1 is assigned the permissions to read from or write to
Folder1.
Refactoring Requirements
Litware identifies the following refactoring requirements:
• New code must be written by reusing the following query:
• The results from the query must be able to be joined to other queries.
Upload Requirements
Litware requires users to upload their job experience in a Word file by using WebApp1.
WebApp1 will send the Word file to DB1 as a stream of bytes. DB1 will then convert the
Word file to text before the contents of the Word file is saved to the Candidates table.
A database developer creates an assembly named Conversions that contains the following:
• A class named Convert in the SqlConversions namespace
• A method named ConvertToText in the Convert class that converts Word files to text
The ConvertToText method accepts a stream of bytes and returns text. The method is used in
the following stored procedure:
Job Application Requirements
A candidate can only apply to each job opening once.
Data Recovery Requirements
All changes to the database are performed by using stored procedures. WebApp1 generates a
unique transaction ID for every stored procedure call that the application makes to the
database.
If a server fails, you must be able to restore data to a specified transaction.
###EndCaseStudy###
You need to implement a solution that meets the security requirements.
Which statement should you execute?
What should you modify in usp_ExportOpenings?
###BeginCaseStudy###
Case Study: 5
Litware, Inc
Overview
General Overview
You are a database developer for a company named Litware, Inc. Litware has a main office in
Miami.
Litware has a job posting web application named WebApp1. WebApp1 uses a database
named DB1. DB1 is hosted on a server named Server1. The database design of DB1 is shown
in the exhibit. (Click the Exhibit button.)
WebApp1 allows a user to log on as a job poster or a job seeker. Candidates can search for
job openings based on keywords, apply to an opening, view their application, and load their
resume in Microsoft Word format. Companies can add a job opening, view the list of
candidates who applied to an opening, and mark an application as denied.
Users and Roles
DB1 has five database users named Company, CompanyWeb, Candidate, CandidateWeb, and
Administrator.
DB1 has three user-defined database roles. The roles are configured as shown in the
following table.
Keyword Search
The keyword searches for the job openings are performed by using the following stored
procedure named usp_GetOpenings:
Opening Update
Updates to the Openings table are performed by using the following stored procedure named
usp_UpdateOpening:
Problems and Reported Issues
Concurrency Problems
You discover that deadlocks frequently occur.
You identify that a stored procedure named usp_AcceptCandidate and a stored procedure
named usp_UpdateCandidate generate deadlocks. The following is the code for
usp_AcceptCandidate:
Salary Query Issues
Users report that when they perform a search for job openings without specifying a minimum
salary, only job openings that specify a minimum salary are displayed.
Log File Growth Issues
The current log file for DB1 grows constantly. The log file fails to shrink even when the daily
SQL Server Agent Shrink Database task runs.
Performance Issues
You discover that a stored procedure named usp_ExportOpenings takes a long time to run
and executes a table scan when it runs.
You also discover that the usp_GetOpenings stored procedure takes a long time to run and
that the non-clustered index on the Description column is not being used.
Page Split Issues
On DB1, many page splits per second spike every few minutes.
Requirements
Security and Application Requirements
Litware identifies the following security and application requirements:
• Only the Administrator, Company, and CompanyWeb database users must be able to
execute the usp_UpdateOpening stored procedure.
• Changes made to the database must not affect WebApp1.
Locking Requirements
Litware identifies the following locking requirements:
• The usp_GetOpenings stored procedure must not be blocked by the
usp_UpdateOpening stored procedure.
• If a row is locked in the Openings table, usp_GetOpenings must retrieve the latest
version of the row, even if the row was not committed yet.
Integration Requirements
Litware exports its job openings to an external company as XML data. The XML data uses
the following format:
A stored procedure named usp_ExportOpenings will be used to generate the XML data. The
following is the code for usp_ExportOpenings:
The stored procedure will be executed by a SQL Server Integration Services (SSIS) package
named Package1.
The XML data will be written to a secured folder named Folder1. Only a dedicated Active
Directory account named Account1 is assigned the permissions to read from or write to
Folder1.
Refactoring Requirements
Litware identifies the following refactoring requirements:
• New code must be written by reusing the following query:
• The results from the query must be able to be joined to other queries.
Upload Requirements
Litware requires users to upload their job experience in a Word file by using WebApp1.
WebApp1 will send the Word file to DB1 as a stream of bytes. DB1 will then convert the
Word file to text before the contents of the Word file is saved to the Candidates table.
A database developer creates an assembly named Conversions that contains the following:
• A class named Convert in the SqlConversions namespace
• A method named ConvertToText in the Convert class that converts Word files to text
The ConvertToText method accepts a stream of bytes and returns text. The method is used in
the following stored procedure:
Job Application Requirements
A candidate can only apply to each job opening once.
Data Recovery Requirements
All changes to the database are performed by using stored procedures. WebApp1 generates a
unique transaction ID for every stored procedure call that the application makes to the
database.
If a server fails, you must be able to restore data to a specified transaction.
###EndCaseStudy###
You need to implement a change to usp_ExportOpenings that meets the integration
requirements.
What should you modify in usp_ExportOpenings? (Each correct answer presents part of the
solution. Choose all that apply?)
What should you include in the recommendation?
###BeginCaseStudy###
Case Study: 5
Litware, Inc
Overview
General Overview
You are a database developer for a company named Litware, Inc. Litware has a main office in
Miami.
Litware has a job posting web application named WebApp1. WebApp1 uses a database
named DB1. DB1 is hosted on a server named Server1. The database design of DB1 is shown
in the exhibit. (Click the Exhibit button.)
WebApp1 allows a user to log on as a job poster or a job seeker. Candidates can search for
job openings based on keywords, apply to an opening, view their application, and load their
resume in Microsoft Word format. Companies can add a job opening, view the list of
candidates who applied to an opening, and mark an application as denied.
Users and Roles
DB1 has five database users named Company, CompanyWeb, Candidate, CandidateWeb, and
Administrator.
DB1 has three user-defined database roles. The roles are configured as shown in the
following table.
Keyword Search
The keyword searches for the job openings are performed by using the following stored
procedure named usp_GetOpenings:
Opening Update
Updates to the Openings table are performed by using the following stored procedure named
usp_UpdateOpening:
Problems and Reported Issues
Concurrency Problems
You discover that deadlocks frequently occur.
You identify that a stored procedure named usp_AcceptCandidate and a stored procedure
named usp_UpdateCandidate generate deadlocks. The following is the code for
usp_AcceptCandidate:
Salary Query Issues
Users report that when they perform a search for job openings without specifying a minimum
salary, only job openings that specify a minimum salary are displayed.
Log File Growth Issues
The current log file for DB1 grows constantly. The log file fails to shrink even when the daily
SQL Server Agent Shrink Database task runs.
Performance Issues
You discover that a stored procedure named usp_ExportOpenings takes a long time to run
and executes a table scan when it runs.
You also discover that the usp_GetOpenings stored procedure takes a long time to run and
that the non-clustered index on the Description column is not being used.
Page Split Issues
On DB1, many page splits per second spike every few minutes.
Requirements
Security and Application Requirements
Litware identifies the following security and application requirements:
• Only the Administrator, Company, and CompanyWeb database users must be able to
execute the usp_UpdateOpening stored procedure.
• Changes made to the database must not affect WebApp1.
Locking Requirements
Litware identifies the following locking requirements:
• The usp_GetOpenings stored procedure must not be blocked by the
usp_UpdateOpening stored procedure.
• If a row is locked in the Openings table, usp_GetOpenings must retrieve the latest
version of the row, even if the row was not committed yet.
Integration Requirements
Litware exports its job openings to an external company as XML data. The XML data uses
the following format:
A stored procedure named usp_ExportOpenings will be used to generate the XML data. The
following is the code for usp_ExportOpenings:
The stored procedure will be executed by a SQL Server Integration Services (SSIS) package
named Package1.
The XML data will be written to a secured folder named Folder1. Only a dedicated Active
Directory account named Account1 is assigned the permissions to read from or write to
Folder1.
Refactoring Requirements
Litware identifies the following refactoring requirements:
• New code must be written by reusing the following query:
• The results from the query must be able to be joined to other queries.
Upload Requirements
Litware requires users to upload their job experience in a Word file by using WebApp1.
WebApp1 will send the Word file to DB1 as a stream of bytes. DB1 will then convert the
Word file to text before the contents of the Word file is saved to the Candidates table.
A database developer creates an assembly named Conversions that contains the following:
• A class named Convert in the SqlConversions namespace
• A method named ConvertToText in the Convert class that converts Word files to text
The ConvertToText method accepts a stream of bytes and returns text. The method is used in
the following stored procedure:
Job Application Requirements
A candidate can only apply to each job opening once.
Data Recovery Requirements
All changes to the database are performed by using stored procedures. WebApp1 generates a
unique transaction ID for every stored procedure call that the application makes to the
database.
If a server fails, you must be able to restore data to a specified transaction.
###EndCaseStudy###
You need to recommend a solution that meets the concurrency problems.
What should you include in the recommendation?
Which statement should you execute on DB1?
###BeginCaseStudy###
Case Study: 5
Litware, Inc
Overview
General Overview
You are a database developer for a company named Litware, Inc. Litware has a main office in
Miami.
Litware has a job posting web application named WebApp1. WebApp1 uses a database
named DB1. DB1 is hosted on a server named Server1. The database design of DB1 is shown
in the exhibit. (Click the Exhibit button.)
WebApp1 allows a user to log on as a job poster or a job seeker. Candidates can search for
job openings based on keywords, apply to an opening, view their application, and load their
resume in Microsoft Word format. Companies can add a job opening, view the list of
candidates who applied to an opening, and mark an application as denied.
Users and Roles
DB1 has five database users named Company, CompanyWeb, Candidate, CandidateWeb, and
Administrator.
DB1 has three user-defined database roles. The roles are configured as shown in the
following table.
Keyword Search
The keyword searches for the job openings are performed by using the following stored
procedure named usp_GetOpenings:
Opening Update
Updates to the Openings table are performed by using the following stored procedure named
usp_UpdateOpening:
Problems and Reported Issues
Concurrency Problems
You discover that deadlocks frequently occur.
You identify that a stored procedure named usp_AcceptCandidate and a stored procedure
named usp_UpdateCandidate generate deadlocks. The following is the code for
usp_AcceptCandidate:
Salary Query Issues
Users report that when they perform a search for job openings without specifying a minimum
salary, only job openings that specify a minimum salary are displayed.
Log File Growth Issues
The current log file for DB1 grows constantly. The log file fails to shrink even when the daily
SQL Server Agent Shrink Database task runs.
Performance Issues
You discover that a stored procedure named usp_ExportOpenings takes a long time to run
and executes a table scan when it runs.
You also discover that the usp_GetOpenings stored procedure takes a long time to run and
that the non-clustered index on the Description column is not being used.
Page Split Issues
On DB1, many page splits per second spike every few minutes.
Requirements
Security and Application Requirements
Litware identifies the following security and application requirements:
• Only the Administrator, Company, and CompanyWeb database users must be able to
execute the usp_UpdateOpening stored procedure.
• Changes made to the database must not affect WebApp1.
Locking Requirements
Litware identifies the following locking requirements:
• The usp_GetOpenings stored procedure must not be blocked by the
usp_UpdateOpening stored procedure.
• If a row is locked in the Openings table, usp_GetOpenings must retrieve the latest
version of the row, even if the row was not committed yet.
Integration Requirements
Litware exports its job openings to an external company as XML data. The XML data uses
the following format:
A stored procedure named usp_ExportOpenings will be used to generate the XML data. The
following is the code for usp_ExportOpenings:
The stored procedure will be executed by a SQL Server Integration Services (SSIS) package
named Package1.
The XML data will be written to a secured folder named Folder1. Only a dedicated Active
Directory account named Account1 is assigned the permissions to read from or write to
Folder1.
Refactoring Requirements
Litware identifies the following refactoring requirements:
• New code must be written by reusing the following query:
• The results from the query must be able to be joined to other queries.
Upload Requirements
Litware requires users to upload their job experience in a Word file by using WebApp1.
WebApp1 will send the Word file to DB1 as a stream of bytes. DB1 will then convert the
Word file to text before the contents of the Word file is saved to the Candidates table.
A database developer creates an assembly named Conversions that contains the following:
• A class named Convert in the SqlConversions namespace
• A method named ConvertToText in the Convert class that converts Word files to text
The ConvertToText method accepts a stream of bytes and returns text. The method is used in
the following stored procedure:
Job Application Requirements
A candidate can only apply to each job opening once.
Data Recovery Requirements
All changes to the database are performed by using stored procedures. WebApp1 generates a
unique transaction ID for every stored procedure call that the application makes to the
database.
If a server fails, you must be able to restore data to a specified transaction.
###EndCaseStudy###
You need to resolve the performance issues of the usp_ExportOpenings stored procedure.
The solution must minimize the amount of hard disk space used.
Which statement should you execute on DB1?
Which line of code should you modify?
###BeginCaseStudy###
Case Study: 5
Litware, Inc
Overview
General Overview
You are a database developer for a company named Litware, Inc. Litware has a main office in
Miami.
Litware has a job posting web application named WebApp1. WebApp1 uses a database
named DB1. DB1 is hosted on a server named Server1. The database design of DB1 is shown
in the exhibit. (Click the Exhibit button.)
WebApp1 allows a user to log on as a job poster or a job seeker. Candidates can search for
job openings based on keywords, apply to an opening, view their application, and load their
resume in Microsoft Word format. Companies can add a job opening, view the list of
candidates who applied to an opening, and mark an application as denied.
Users and Roles
DB1 has five database users named Company, CompanyWeb, Candidate, CandidateWeb, and
Administrator.
DB1 has three user-defined database roles. The roles are configured as shown in the
following table.
Keyword Search
The keyword searches for the job openings are performed by using the following stored
procedure named usp_GetOpenings:
Opening Update
Updates to the Openings table are performed by using the following stored procedure named
usp_UpdateOpening:
Problems and Reported Issues
Concurrency Problems
You discover that deadlocks frequently occur.
You identify that a stored procedure named usp_AcceptCandidate and a stored procedure
named usp_UpdateCandidate generate deadlocks. The following is the code for
usp_AcceptCandidate:
Salary Query Issues
Users report that when they perform a search for job openings without specifying a minimum
salary, only job openings that specify a minimum salary are displayed.
Log File Growth Issues
The current log file for DB1 grows constantly. The log file fails to shrink even when the daily
SQL Server Agent Shrink Database task runs.
Performance Issues
You discover that a stored procedure named usp_ExportOpenings takes a long time to run
and executes a table scan when it runs.
You also discover that the usp_GetOpenings stored procedure takes a long time to run and
that the non-clustered index on the Description column is not being used.
Page Split Issues
On DB1, many page splits per second spike every few minutes.
Requirements
Security and Application Requirements
Litware identifies the following security and application requirements:
• Only the Administrator, Company, and CompanyWeb database users must be able to
execute the usp_UpdateOpening stored procedure.
• Changes made to the database must not affect WebApp1.
Locking Requirements
Litware identifies the following locking requirements:
• The usp_GetOpenings stored procedure must not be blocked by the
usp_UpdateOpening stored procedure.
• If a row is locked in the Openings table, usp_GetOpenings must retrieve the latest
version of the row, even if the row was not committed yet.
Integration Requirements
Litware exports its job openings to an external company as XML data. The XML data uses
the following format:
A stored procedure named usp_ExportOpenings will be used to generate the XML data. The
following is the code for usp_ExportOpenings:
The stored procedure will be executed by a SQL Server Integration Services (SSIS) package
named Package1.
The XML data will be written to a secured folder named Folder1. Only a dedicated Active
Directory account named Account1 is assigned the permissions to read from or write to
Folder1.
Refactoring Requirements
Litware identifies the following refactoring requirements:
• New code must be written by reusing the following query:
• The results from the query must be able to be joined to other queries.
Upload Requirements
Litware requires users to upload their job experience in a Word file by using WebApp1.
WebApp1 will send the Word file to DB1 as a stream of bytes. DB1 will then convert the
Word file to text before the contents of the Word file is saved to the Candidates table.
A database developer creates an assembly named Conversions that contains the following:
• A class named Convert in the SqlConversions namespace
• A method named ConvertToText in the Convert class that converts Word files to text
The ConvertToText method accepts a stream of bytes and returns text. The method is used in
the following stored procedure:
Job Application Requirements
A candidate can only apply to each job opening once.
Data Recovery Requirements
All changes to the database are performed by using stored procedures. WebApp1 generates a
unique transaction ID for every stored procedure call that the application makes to the
database.
If a server fails, you must be able to restore data to a specified transaction.
###EndCaseStudy###
You need to implement a solution that meets the locking requirements.
Which line of code should you modify?
What should you implement?
###BeginCaseStudy###
Case Study: 6
Coho Winery
Overview
You are a database developer for a company named Coho Winery. Coho Winery has an
office in London.
Coho Winery has an application that is used to process purchase orders from customers and
retailers in 10 different countries.
The application uses a web front end to process orders from the Internet. The web front end
adds orders to a database named Sales. The Sales database is managed by a server named
Server1.
An empty copy of the Sales database is created on a server named Server2 in the London
office. The database will store sales data for customers in Europe.
A new version of the application is being developed. In the new version, orders will be placed
either by using the existing web front end or by loading an XML file.
Once a week, you receive two files that contain the purchase orders and the order details of
orders fromoffshore facilities.
You run the usp_ImportOders stored procedure and the usp_ImportOrderDetails stored
procedure to copy the offshore facility orders to the Sales database.
The Sales database contains a table named Orders that has more than 20 million rows.
Database Definitions
Database and Tables
The following scripts are used to create the database and its tables:
Stored Procedures
The following are the definitions of the stored procedures used in the database:
Indexes
The following indexes are part of the Sales database:
Data Import
The XML files will contain the list of items in each order. Each retailer will have its own
XML schema and will be able to use different types of encoding. Each XML schema will use
a default namespace. The default namespaces are not guaranteed to be unique.
For testing purposes, you receive an XSD file from a customer.
For testing purposes, you also create an XML schema collection named ValidateOrder.
ValidateOrder contains schemas for all of the retailers.
The new version of the application must validate the XML file, parse the data, and store the
parsed data along with the original XML file in the database. The original XML file must be
stored without losing any data.
Reported Issues
Performance Issues
You notice the following for the usp_GetOrdersAndItems stored procedure:
• The stored procedure takes a long time to complete.
• Less than two percent of the rows in the Orders table are retrieved by
usp_GetOrdersAndItems.
• A full table scan runs when the stored procedure executes.
• The amount of disk space used and the amount of time required to insert data are very
high.
You notice that the usp_GetOrdersByProduct stored procedure uses a table scan when the
stored procedure is executed.
Page Split Issues
Updates to the Orders table cause excessive page splits on the IX_Orders_ShipDate index.
Requirements
Site Requirements
Users located in North America must be able to view sales data for customers in North
America and Europe in a single report. The solution must minimize the amount of traffic over
the WAN link between the offices.
Bulk Insert Requirements
The usp_ImportOrderDetails stored procedure takes more than 10 minutes to complete. The
stored procedure runs daily. If the stored procedure fails, you must ensure that the stored
procedure restarts from the last successful set of rows.
Index Monitoring Requirements
The usage of indexes in the Sales database must be monitored continuously. Monitored data
must be maintained if a server restarts. The monitoring solution must minimize the usage of
memory resources and processing resources.
###EndCaseStudy###
You need to implement a solution that meets the site requirements.
What should you implement?
What should you add to usp_GetOrdersAndItems?
###BeginCaseStudy###
Case Study: 6
Coho Winery
Overview
You are a database developer for a company named Coho Winery. Coho Winery has an
office in London.
Coho Winery has an application that is used to process purchase orders from customers and
retailers in 10 different countries.
The application uses a web front end to process orders from the Internet. The web front end
adds orders to a database named Sales. The Sales database is managed by a server named
Server1.
An empty copy of the Sales database is created on a server named Server2 in the London
office. The database will store sales data for customers in Europe.
A new version of the application is being developed. In the new version, orders will be placed
either by using the existing web front end or by loading an XML file.
Once a week, you receive two files that contain the purchase orders and the order details of
orders fromoffshore facilities.
You run the usp_ImportOders stored procedure and the usp_ImportOrderDetails stored
procedure to copy the offshore facility orders to the Sales database.
The Sales database contains a table named Orders that has more than 20 million rows.
Database Definitions
Database and Tables
The following scripts are used to create the database and its tables:
Stored Procedures
The following are the definitions of the stored procedures used in the database:
Indexes
The following indexes are part of the Sales database:
Data Import
The XML files will contain the list of items in each order. Each retailer will have its own
XML schema and will be able to use different types of encoding. Each XML schema will use
a default namespace. The default namespaces are not guaranteed to be unique.
For testing purposes, you receive an XSD file from a customer.
For testing purposes, you also create an XML schema collection named ValidateOrder.
ValidateOrder contains schemas for all of the retailers.
The new version of the application must validate the XML file, parse the data, and store the
parsed data along with the original XML file in the database. The original XML file must be
stored without losing any data.
Reported Issues
Performance Issues
You notice the following for the usp_GetOrdersAndItems stored procedure:
• The stored procedure takes a long time to complete.
• Less than two percent of the rows in the Orders table are retrieved by
usp_GetOrdersAndItems.
• A full table scan runs when the stored procedure executes.
• The amount of disk space used and the amount of time required to insert data are very
high.
You notice that the usp_GetOrdersByProduct stored procedure uses a table scan when the
stored procedure is executed.
Page Split Issues
Updates to the Orders table cause excessive page splits on the IX_Orders_ShipDate index.
Requirements
Site Requirements
Users located in North America must be able to view sales data for customers in North
America and Europe in a single report. The solution must minimize the amount of traffic over
the WAN link between the offices.
Bulk Insert Requirements
The usp_ImportOrderDetails stored procedure takes more than 10 minutes to complete. The
stored procedure runs daily. If the stored procedure fails, you must ensure that the stored
procedure restarts from the last successful set of rows.
Index Monitoring Requirements
The usage of indexes in the Sales database must be monitored continuously. Monitored data
must be maintained if a server restarts. The monitoring solution must minimize the usage of
memory resources and processing resources.
###EndCaseStudy###
You need to modify usp_GetOrdersAndItems to ensure that an order is NOT retrieved by
usp_GetOrdersAndItems while the order is being updated.
What should you add to usp_GetOrdersAndItems?
Which statement should you execute?
###BeginCaseStudy###
Case Study: 6
Coho Winery
Overview
You are a database developer for a company named Coho Winery. Coho Winery has an
office in London.
Coho Winery has an application that is used to process purchase orders from customers and
retailers in 10 different countries.
The application uses a web front end to process orders from the Internet. The web front end
adds orders to a database named Sales. The Sales database is managed by a server named
Server1.
An empty copy of the Sales database is created on a server named Server2 in the London
office. The database will store sales data for customers in Europe.
A new version of the application is being developed. In the new version, orders will be placed
either by using the existing web front end or by loading an XML file.
Once a week, you receive two files that contain the purchase orders and the order details of
orders fromoffshore facilities.
You run the usp_ImportOders stored procedure and the usp_ImportOrderDetails stored
procedure to copy the offshore facility orders to the Sales database.
The Sales database contains a table named Orders that has more than 20 million rows.
Database Definitions
Database and Tables
The following scripts are used to create the database and its tables:
Stored Procedures
The following are the definitions of the stored procedures used in the database:
Indexes
The following indexes are part of the Sales database:
Data Import
The XML files will contain the list of items in each order. Each retailer will have its own
XML schema and will be able to use different types of encoding. Each XML schema will use
a default namespace. The default namespaces are not guaranteed to be unique.
For testing purposes, you receive an XSD file from a customer.
For testing purposes, you also create an XML schema collection named ValidateOrder.
ValidateOrder contains schemas for all of the retailers.
The new version of the application must validate the XML file, parse the data, and store the
parsed data along with the original XML file in the database. The original XML file must be
stored without losing any data.
Reported Issues
Performance Issues
You notice the following for the usp_GetOrdersAndItems stored procedure:
• The stored procedure takes a long time to complete.
• Less than two percent of the rows in the Orders table are retrieved by
usp_GetOrdersAndItems.
• A full table scan runs when the stored procedure executes.
• The amount of disk space used and the amount of time required to insert data are very
high.
You notice that the usp_GetOrdersByProduct stored procedure uses a table scan when the
stored procedure is executed.
Page Split Issues
Updates to the Orders table cause excessive page splits on the IX_Orders_ShipDate index.
Requirements
Site Requirements
Users located in North America must be able to view sales data for customers in North
America and Europe in a single report. The solution must minimize the amount of traffic over
the WAN link between the offices.
Bulk Insert Requirements
The usp_ImportOrderDetails stored procedure takes more than 10 minutes to complete. The
stored procedure runs daily. If the stored procedure fails, you must ensure that the stored
procedure restarts from the last successful set of rows.
Index Monitoring Requirements
The usage of indexes in the Sales database must be monitored continuously. Monitored data
must be maintained if a server restarts. The monitoring solution must minimize the usage of
memory resources and processing resources.
###EndCaseStudy###
You need to implement a solution that addresses the performance issues of the
usp_GetOrdersByProduct stored procedure.
Which statement should you execute?
What should you add to line 08 in usp_ImportOrderDetails?
###BeginCaseStudy###
Case Study: 6
Coho Winery
Overview
You are a database developer for a company named Coho Winery. Coho Winery has an
office in London.
Coho Winery has an application that is used to process purchase orders from customers and
retailers in 10 different countries.
The application uses a web front end to process orders from the Internet. The web front end
adds orders to a database named Sales. The Sales database is managed by a server named
Server1.
An empty copy of the Sales database is created on a server named Server2 in the London
office. The database will store sales data for customers in Europe.
A new version of the application is being developed. In the new version, orders will be placed
either by using the existing web front end or by loading an XML file.
Once a week, you receive two files that contain the purchase orders and the order details of
orders fromoffshore facilities.
You run the usp_ImportOders stored procedure and the usp_ImportOrderDetails stored
procedure to copy the offshore facility orders to the Sales database.
The Sales database contains a table named Orders that has more than 20 million rows.
Database Definitions
Database and Tables
The following scripts are used to create the database and its tables:
Stored Procedures
The following are the definitions of the stored procedures used in the database:
Indexes
The following indexes are part of the Sales database:
Data Import
The XML files will contain the list of items in each order. Each retailer will have its own
XML schema and will be able to use different types of encoding. Each XML schema will use
a default namespace. The default namespaces are not guaranteed to be unique.
For testing purposes, you receive an XSD file from a customer.
For testing purposes, you also create an XML schema collection named ValidateOrder.
ValidateOrder contains schemas for all of the retailers.
The new version of the application must validate the XML file, parse the data, and store the
parsed data along with the original XML file in the database. The original XML file must be
stored without losing any data.
Reported Issues
Performance Issues
You notice the following for the usp_GetOrdersAndItems stored procedure:
• The stored procedure takes a long time to complete.
• Less than two percent of the rows in the Orders table are retrieved by
usp_GetOrdersAndItems.
• A full table scan runs when the stored procedure executes.
• The amount of disk space used and the amount of time required to insert data are very
high.
You notice that the usp_GetOrdersByProduct stored procedure uses a table scan when the
stored procedure is executed.
Page Split Issues
Updates to the Orders table cause excessive page splits on the IX_Orders_ShipDate index.
Requirements
Site Requirements
Users located in North America must be able to view sales data for customers in North
America and Europe in a single report. The solution must minimize the amount of traffic over
the WAN link between the offices.
Bulk Insert Requirements
The usp_ImportOrderDetails stored procedure takes more than 10 minutes to complete. The
stored procedure runs daily. If the stored procedure fails, you must ensure that the stored
procedure restarts from the last successful set of rows.
Index Monitoring Requirements
The usage of indexes in the Sales database must be monitored continuously. Monitored data
must be maintained if a server restarts. The monitoring solution must minimize the usage of
memory resources and processing resources.
###EndCaseStudy###
You need to implement a solution that addresses the bulk insert requirements.
What should you add to line 08 in usp_ImportOrderDetails?
You need to ensure that usp_GetOrdersAndItems completes as quickly as possible
###BeginCaseStudy###
Case Study: 6
Coho Winery
Overview
You are a database developer for a company named Coho Winery. Coho Winery has an
office in London.
Coho Winery has an application that is used to process purchase orders from customers and
retailers in 10 different countries.
The application uses a web front end to process orders from the Internet. The web front end
adds orders to a database named Sales. The Sales database is managed by a server named
Server1.
An empty copy of the Sales database is created on a server named Server2 in the London
office. The database will store sales data for customers in Europe.
A new version of the application is being developed. In the new version, orders will be placed
either by using the existing web front end or by loading an XML file.
Once a week, you receive two files that contain the purchase orders and the order details of
orders fromoffshore facilities.
You run the usp_ImportOders stored procedure and the usp_ImportOrderDetails stored
procedure to copy the offshore facility orders to the Sales database.
The Sales database contains a table named Orders that has more than 20 million rows.
Database Definitions
Database and Tables
The following scripts are used to create the database and its tables:
Stored Procedures
The following are the definitions of the stored procedures used in the database:
Indexes
The following indexes are part of the Sales database:
Data Import
The XML files will contain the list of items in each order. Each retailer will have its own
XML schema and will be able to use different types of encoding. Each XML schema will use
a default namespace. The default namespaces are not guaranteed to be unique.
For testing purposes, you receive an XSD file from a customer.
For testing purposes, you also create an XML schema collection named ValidateOrder.
ValidateOrder contains schemas for all of the retailers.
The new version of the application must validate the XML file, parse the data, and store the
parsed data along with the original XML file in the database. The original XML file must be
stored without losing any data.
Reported Issues
Performance Issues
You notice the following for the usp_GetOrdersAndItems stored procedure:
• The stored procedure takes a long time to complete.
• Less than two percent of the rows in the Orders table are retrieved by
usp_GetOrdersAndItems.
• A full table scan runs when the stored procedure executes.
• The amount of disk space used and the amount of time required to insert data are very
high.
You notice that the usp_GetOrdersByProduct stored procedure uses a table scan when the
stored procedure is executed.
Page Split Issues
Updates to the Orders table cause excessive page splits on the IX_Orders_ShipDate index.
Requirements
Site Requirements
Users located in North America must be able to view sales data for customers in North
America and Europe in a single report. The solution must minimize the amount of traffic over
the WAN link between the offices.
Bulk Insert Requirements
The usp_ImportOrderDetails stored procedure takes more than 10 minutes to complete. The
stored procedure runs daily. If the stored procedure fails, you must ensure that the stored
procedure restarts from the last successful set of rows.
Index Monitoring Requirements
The usage of indexes in the Sales database must be monitored continuously. Monitored data
must be maintained if a server restarts. The monitoring solution must minimize the usage of
memory resources and processing resources.
###EndCaseStudy###
You discover that the usp_GetOrdersAndItems stored procedures takes a long time to
complete while usp_AddOrder or usp_AddXMLOrder run.
You need to ensure that usp_GetOrdersAndItems completes as quickly as possible.
What should you do? (Each correct answer presents part of the solution. Choose all that
apply.)