###BeginCaseStudy###
Case Study: 4
Scenario 4
Application Information
You are a database administrator for a manufacturing company.
You have an application that stores product data. The data will be converted to technical
diagrams for the manufacturing process.
The product details are stored in XML format. Each XML must contain only one product that
has a root element named Product. A schema named Production.ProductSchema has been
created for the products xml.
You develop a Microsoft .NET Framework assembly named ProcessProducts.dll that will be
used to convert the XML files to diagrams. The diagrams will be stored in the database as
images. ProcessProducts.dll contains one class named ProcessProduct that has a method
name of Convert(). ProcessProducts.dll was created by using a source code file named
ProcessProduct.es.
All of the files are located in C:\Products\.
The application has several performance and security issues.
You will create a new database named ProductsDB on a new server that has SQL Server
2012 installed. ProductsDB will support the application.
The following graphic shows the planned tables for ProductsDB:
You will also add a sequence named Production.ProductID_Seq.
You plan to create two certificates named DBCert and ProductsCert. You will create
ProductsCert in master. You will create DBCert in ProductsDB.
You have an application that executes dynamic T-SQL statements against ProductsDB. A
sample of the queries generated by the application appears in Dynamic.sql.
Application Requirements
The planned database has the following requirements:
• All stored procedures must be signed.
• The amount of disk space must be minimized.
• Administrative effort must be minimized at all times.
• The original product details must be stored in the database.
• An XML schema must be used to validate the product details.
• The assembly must be accessible by using T-SQL commands.
• A table-valued function will be created to search products by type.
• Backups must be protected by using the highest level of encryption.
• Dynamic T-SQL statements must be converted to stored procedures.
• Indexes must be optimized periodically based on their fragmentation.
• Manufacturing steps stored in the ManufacturingSteps table must refer to a product by
the sameidentifier used by the Products table.
ProductDetails_Insert.sql
Product, xml
All product types are 11 digits. The first five digits of the product id reference the category of
the product and the remaining six digits are the subcategory of the product.
The following is a sample customer invoice in XML format:
IndexManagement.sql
###EndCaseStudy###
While testing the CategoryFromType function, you discover that the function is returning
‘Other’.
You need to update CategoryFromType to return the category name.
Which line of code should you modify in CategoryFromType.sql?
A.
04
B.
05
C.
12
D.
14
None of the answers are correct .. the correct one is that you should remove the ‘ in front of the numbers and it will work so instead of ‘00001’ then 00001
The erroneous line is line05 containing the code: SET @Category = LEFT(@Category, 5).
The ‘ ‘ was deliberately used with each categoryID to be able to apply the string function “LEFT” on them. By omitting the string operator from line05, there won’t be need to insert each categoryID in a ‘ ‘ anymore.
The answer is C (line 12). It means that there are more categories, including 0001 , 0002
Are you for real?! Seriously?!
Who doesn’t know that there are more categories in there?! Or, what did you think the ellipsis ( … ) included at line 11 was meant to denote?! Wasn’t it meant to show that some lines of code (‘other categories’) had been omitted?!
the answer should be 06 line:
select @category = case left(@type, 5)
The correct answer is not available in option listed
@Type is declared with a maximum length of 11, and it appears to being used to store two pieces of information in a single field. Line 5 appears to be extracting the first part of this dual-purpose field, except that it is being done on the @category variable rather than the @type variable.
Line 5 needs to be modified to replace @category with @type to ensure the expected value is passed to the case statement.
Additionally the developer should be shot for crimes against database design.
should be SET @TYPE = LEFT(@TYPE, 5)