首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. Users report that sever
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. Users report that sever
admin
2009-05-19
62
问题
You are the administrator of a SQL Server 2000 computer. The server contains a database named Inventory. Users report that several storage locations in the UnitsStored field contain negative numbers. You examine the database’s table structure. The table properties are configured as shown in the exhibit.
You correct all the negative numbers in the table. You must prevent the database from storing negative numbers. You also want to minimize use of server resources and physical I/O.
Which transact-SQL statement should you execute?
选项
A、ALTER TABLE dbo.storagelocations ADD CONSTRAINTS
CK_storagelocations_UnitsStored
CHECK (UnitsStored>= 0)
B、CREATE TRIGGER CK_UnitsStored On StorageLocations
FOR INSERT, UPDATE AS
IF INSERTED, UnitsStored < 0 ROLLBACK TRAN
C、CREATE TABLE ck_unitsstored As @Units >= 0
GO
Sp_bindrule ‘OK_UnitsStored’,
‘StorageLocations, UnitsStored’
GO
D、CREATE PROC UpdateUnitsStored
(StorageLocationID int, @UnitsStored bigint)AS
IF @UnitsStored < 0
DATSERROR (50099, 17)
ELSE
UPDATE storaheLocations
SET UnitsStored = @UnitsStored
WHERE StorageLocationID = @storageLocationID
答案
A
解析
Explanation: CHECK constraints are used to enforce domain integrity by restricting the values that are accepted by a column. They determine which values are valid by testing a logical expression that is not based on data in another column. The problem posed by this scenario can be solved through the implementation of such a constraint. In this solution the CHECK constraint is added in line 1 and the CHECK expression is specified in line 3. The expression specifies that the values contained in the UnitsStored column must be more than or equal to 0.
Incorrect Answers:
B: This solution uses a trigger to perform the CHECK constraint, which a trigger can do. However, it is recommended that triggers only be used when the CHECK constraint cannot meet the functionality required by the application. This is thus not the best answer.
C: In this solution creates a new table is created with the CREATE TABLE statement. This is inappropriate to the problem, as it does not address the insertion of negative values in the existing table.
D: This solution creates a stored procedure to perform the CHECK constraint.
转载请注明原文地址:https://kaotiyun.com/show/uuhZ777K
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Climatechangeissupposedtounfoldslowly,overdecades.Butthatisnottrueupinthegreatwhitenorth,asthoseattending
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
[A]"Ijustdon’tknowhowtomotivatethemtodoabetterjob.We’reinabudgetcrunchandIhaveabsolutelynofinancialrewa
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
TheU.S.PostalService(USPS)continuestobleedredink.Itreportedanetlossof$5.6billionforfiscal2016,the10thst
NextmonthBritonswillhaveyetmoresmartphonestochoosefrom,whendevicesfromWiko,atwo-year-oldFrenchcompany,goons
GivingmillionsofexistingPayPalcustomerstheabilitytobuyattheclickofabuttonhasenormouspotentialforincreasing
Thefollowingscenariowillbeusedforquestions29and30.Johnisanetworkadministratorandhasbeentoldbyoneofhisnet
随机试题
急性心肌梗死后窦速伴有室性期前收缩,优先使用的抗心律失常药物是
哪一组织器官的生长模式不属于一般型
患者,女性,19岁,左侧颞下颌关节区疼痛伴开闭、前伸、侧方运动的任何阶段有多声破碎音1个月。根据杂音判断,该患者最可能的诊断是A.左可复性关节盘前移位B.左翼外肌功能亢进C.左关节盘穿孔、破裂D.左关节囊扩张伴关节盘附着松弛E.以上均不对
对于我国大型或特大型建设项目,控制性施工进度计划的编制任务可以由( )承担。
根据《建设工程工程量清单计价规范》GB50500—2013,在编制工程量清单时,招标人对施工中噪声污染提出防护要求的描述应列在()中。
下列选项中,属于国际资本流动的原因有()。Ⅰ.利率原因Ⅱ.金融原因Ⅲ.贸易原因Ⅳ.制度原因
甲公司和乙公司2013年有关交易或事项如下:(1)1月1日,甲公司以银行存款2000万元购入乙公司70%的股权,实现了对乙公司财务和经营政策的控制,当日办理完毕股权登记手续,不考虑相关税费,另以银行存款支付中介机构评估乙公司资产的评估费20万元。当日乙公
(2009年)甲公司向乙公司购买水泵一台,为支付货款,签发了一张以自己为出票人、以乙公司为收款人、以M银行为承兑人、票面金额为30万元、到期日为2008年8月3日的银行承兑汇票,并交付给乙公司。甲公司和M银行均在该汇票上进行了签章。乙公司的财务人员A利用
物业服务成本或者物业服务支出构成一般包括以下部分()。
根据2015年中共中央政治局审议通过的《京津冀协同发展规划纲要》,北京的城市功能定位为()。
最新回复
(
0
)