Você está na página 1de 3

Question 1:

- Create a Database C0xxx_ROLLNUMBER


- Use this Database

Question 2:
- Using Create XML schema … statement to create the XML schema with name
“StudentSchemaXML” that the element root name has “Students” with attributes as following:

<xsd:element name="MaSV" type="xsd:string" />


<xsd:element name="TenSV" type="xsd:string" />
<xsd:element name="NgaySinh" type="xsd:string" />
<xsd:element name="DiemTD" type="xsd:string" />

- Using Create table statement to create an [Students] table as following:


o Column 1: [StudentID] int NOT NULL
o Column 2: [StudentDetails] XML (Tips: using xml schema with name
“StudentSchemaXML” to validates data for this column)

- Apply the Primary Key Constraint for the “StudentID” column of the [Students] table.

Question 3:
- Using Create message … statement to create a message type with name “C0xxxMessageType”
for the system. Please check the message type in order to make sure that the data is in proper
XML format.
- Using Create contract … statement to create a contract with name “StudentContract” for the
system that uses the “C0xxxMessageType” message type.
- Using Create queue … statement to create a queue with name “StudentQueue” for the system.
- Using Create service … statement to create two services with name
“StudentRequestClientService” and “StudentRequestServerService” for the system that uses
the “StudentContract” contract and “StudentQueue” queue.
- Using Create procedure … statement to create a procedure with name
“StudentRequestProcedure” for the system that inserts the record into [Students] table.
(Tips: Store procedure have two parameters :@StudentID int, @StudentInfor xml)
o Create dialog conversation on “StudentContract” contract
o Send conversation belong to “C0xxxMessageType” message type from service client
(Service Consumer) to service server (Service Provider).

Practical Paper QP Page 1 of 3


- Using Create procedure … statement to create a procedure with name
“StudentResponseProcedure” for the system. Please check whether the queue is empty or not.
o If the queue is not empty then now read the queue using the stored procedure created.
o If the queue is empty then return message ‘The queue is empty’
- Run time two stored procedure above with parameter as following:
o MaSV: Your Roll Number
o TenSV: Your Name
o NgaySinh: Your Date Of Birth
o DiemTD: 10

Question 4:
- Using Create procedure … statement to create a procedure with name “GetStudentName” to
query value of [TenSV] element in [StudentDetails] column in “Students” table with parameter
@StudentID int.
- Using sp_reserve_http_namespace … statement to register a HTTP endpoint with name
http://localhost:8080/GetStudentDetails:
- Using Create endpoint … statement to create an endpoint with name
“GetStudentNameEndPoint” endpoint.
o PATH Name: /GetStudentDetails
o WEBMETHOD Name: GetStudentName
o Stored procedure name: C0xxx_ROLLNUMBER.DBO. GetStudentName
o DATABASE: C0xxx_ROLLNUMBER
o NAMESPACE: http://aptech-news.com/ C0xxxRollNumber
Question 5:
- Suppose that:
o There is a DLL file with name “SelectTable_SP.dll” that stored in “..\Exam” directory.
The student will be supply this DLL file
o The source code as following:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class SelectTable
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void SelectStudent(SqlInt32 StudentID)
{
// Tao SqlPipe class.
SqlPipe sqlPipe = SqlContext.Pipe;

Practical Paper QP Page 2 of 3


try
{
// Tao SqlConnection class
SqlConnection sqlcon = new SqlConnection("context connection=true");
SqlCommand sqlcom_Student = new SqlCommand();
sqlcom_Student.Connection = sqlcon;
sqlcom_Student.CommandText = "Select
StudentID,cast(StudentDetails.query('data(/Students/TenSV)') as nvarchar(100) )as
TENSV from Students where StudentID = @StudentID";
// Creates an instance of SqlParameter class.
SqlParameter StudentIDParam = new SqlParameter("@StudentID",
SqlDbType.Int);
sqlcom_Student.Parameters.Add(StudentIDParam);
StudentIDParam.Value = StudentID;

sqlcon.Open(); //
SqlDataReader objdata = sqlcom_Student.ExecuteReader();
sqlPipe.Send(objdata);
sqlcon.Close();
}
catch (SqlException sqlEx)
{
// Loi
sqlPipe.Send("Error: " + sqlEx.Message);
}
}
}

- Using Create Assembly … statement to register an assembly with name “StudentAssembly” to


SQL Server 2005 from “SelectTable_SP.dll” file.
- Using Create procedure … statement to create a procedure with name
“GetStudentNameAssembly” with parameter @StudentID int from external name
“StudentAssembly” assembly.
- Run time “GetStudentNameAssembly” stored procedure above with parameter as following:
o @StudentID equal value of inputting above.
Result of execute stored procedure:

Tips: Using sp_configure @configname = 'clr enabled', @configvalue = 1 to enable CLR.

Question 6:
- Using Visual studio 2005 tools (or other tool) to create an instance configuration file (xml file)
with name “SendLoveC0xxx_ICF.xml”.
Tips: Using book online for searching Syntax to create instance of Notification Services

Practical Paper QP Page 3 of 3

Você também pode gostar