首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
You are the administrator of a SQL Server 2000 computer. The server contains a database named inventory. The database has a Part
You are the administrator of a SQL Server 2000 computer. The server contains a database named inventory. The database has a Part
admin
2009-05-19
16
问题
You are the administrator of a SQL Server 2000 computer. The server contains a database named inventory. The database has a Parts table that has a field named InStock. When parts are shipped, a table named PartsShipped is updated. When Parts are received, a table names PartsReceived is updated. The relationship of these tables is shown in the exhibit.
You want the database to update the InStock field automatically. What should you do?
选项
A、Add triggers to the PartsShipped and the PartsReceived tables that update the InStock field in the Parts table.
B、Create a user-defined function those calculations that calculates current inventory by running aggregate queries on the PartsShipped and PartsReceived tables.
C、Use a view that creates an InStock as a part of an aggregate query.
D、Create stored procedures for modifying the PartsReceived and the PartsShipped tables that also modify the InStock fielding the parts table. Use these procedures exclusively when modifying data in the PartsReceived and the PartsShipped tables.
答案
A
解析
Explanation: Triggers are a special class of stored procedure defined to fire automatically when an UPDATE, INSERT, or DELETE statement is issued against a table or view. They are powerful tools that can be used to enforce business rules automatically when data is modified.
Triggers can extend the integrity checking logic of SQL Server constraints, defaults, and rules, although constraints and defaults should be used instead whenever they provide all the needed functionality. In this scenario an AFTER UPDATE trigger can be used to update the tables to update the PartsShipped and the PartsReceived tables that update the InStock column in the parts table.
Incorrect Answers:
B: A user-defined function is a subroutine that is made up of one or more Transact-SQL statements and can be used to encapsulate code for reuse. It can be used to run aggregate calculations. However, a simple update of the InStock column, and not a aggregate function, is required when changes are made to the PartsShipped and PartsReceived tables. This can be accomplished through the use of triggers.
C: A view would not be able to detect changes in any of the columns.
Note: A view is a virtual table that allows data to be accessible through it rather than through the base table. A view can be referenced through Transact-SQL statements in the same way a table is. In addition a table can be used to restrict a user to specific rows and/or columns in a table, join columns from multiple tables so that they appear as a single virtual table and can aggregate information instead of supplying details to the user.
D: A simple update of the InStock column, and not a stored procedure, is required when changes are made to the PartsShipped and PartsReceived tables. This can be accomplished through the use of triggers.
Note: A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. Stored procedures can return data as output parameters; return codes; a result set for each SELECT statement contained in the stored procedure or any other stored procedures called by the stored procedure; or a global cursor that can be referenced outside the stored procedure. Stored procedures assist in achieving a consistent implementation of logic across applications and can improve performance.
转载请注明原文地址:https://jikaoti.com/ti/AwO7FFFM
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
Writealettertooneofyourfriends,apologizingtohim/herforyourmakinghis/hercomputerstopworking.Youshouldwrite
Supposeyouorderedahairdryeronlineatthecostof$22,butonlyreceivedanemptypackagebox.Somethingmustbewrong.Wri
SupposeyouphonedyourfriendMaryseveraltimesyesterdaybutshedidn’tansweryourcallatall.Writeheranemailto1
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
"Thisisareallyexcitingtime—aneweraisstarting,"saysPeterBazalgette,thechiefcreativeofficerofEndemol,thetelev
LastThursday,theFrenchSenatepassedadigitalservicestax,whichwouldimposeanentirelynewtaxonlargemultinationalst
在用户管理组administrators中添加本地用户“sy”。
随机试题
请简述实际成本核算的一般流程。
36岁男性Crohn病患者,发生肛周脓肿,选用下列哪种药物既可以控制感染又有助于缓解Crohn病的病情
建设工程监理是指( )受项目法人的委托,对工程建设实施监督管理。
中国境内某出版社的作家2016年11月将其精选的散文作品交由本社出版,取得报酬10万元。该笔报酬在计算缴纳个人所得税时适用的税目是()。
大海3COM合资公司出现亏损,也许能让大海思考如何更好地走向国际化。一位业内人士指出:“大海公司CEO这位具有优患意识的商业领袖,应能从中反思大海在成为全球性跨国公司过程中所面对的问题和困难。”合资双方的企业文化背景明显不同。一位3COM的员工表示,
以狮、虎为代表作的是四大名绣中的()。
NotthatJohndoesn’twanttohelpyou,______it’sbeyondhispower.
请以“唐曹铁路”为主语,将下面几个句子合成一个长句。要求:必须是单句,不得丢掉语句中的信息。(可增删个别词语)(1)唐曹铁路是拉动唐山经济腾飞的重要通道。(2)唐曹铁路沟通唐山市区与曹妃甸港区。(3)唐曹铁路被称为曹妃甸开发的
行政机关依照规定实施加处罚款或者滞纳金超过()日,经催告当事人仍不履行的,具有行政强制执行权的行政机关可以强制执行。
为了使窗体的大小可以改变,必须把它的BorderStyle属性设置为
最新回复
(
0
)