首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
58
问题
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
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
[A]"Ijustdon’tknowhowtomotivatethemtodoabetterjob.We’reinabudgetcrunchandIhaveabsolutelynofinancialrewa
AlmosteveryyearsincetheendofthefinancialcrisishasstartedwithrosyexpectationsamongAmericanforecasters,andthis
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
TheU.S.PostalService(USPS)continuestobleedredink.Itreportedanetlossof$5.6billionforfiscal2016,the10thst
TheU.S.PostalService(USPS)continuestobleedredink.Itreportedanetlossof$5.6billionforfiscal2016,the10thst
InParagraphs1and2,thetextshowsPTK’s______.Skepticalobserversbelievethatancestrytestingfailsto______.
Writealettertorecommendyourstudent,LiXu,forapositionofadministratorinacompany.Youshouldincludethedetailsyo
在用户管理组administrators中删除lusi用户。
随机试题
从各种可供选择的方案中,权衡利弊,选择其一。这是决策程序中的()
氯霉素的抗菌作用是由于抑制了细菌的
案例四:李小姐是一家外企的中层管理员,有50万元人民币,考虑到目前银行存款利率较低,而股市正走向牛市,想将这笔钱来做证券投资,李小姐在深圳证券交易所买了ABC公司的A股股票和ABC公司发行的可转换债券,并且买了正在发行的面值为100元的10年期国债,国债
某按月纳税的纳税信用A级的食品生产企业(增值税一般纳税人)无违章违规行为,也未享受即征即退、先征后返(退)政策,该企业2019年3月末增值税留抵税额15万元,4月末至11月末增值税留抵税额分别是18万元、10万元、25万元、35万元、78万元、75万元、7
数学学习中形成的认真审题及审题方法会影响化学、物理等学习的审题态度及审题方法,这种学习迁移叫()。
主送机关必须是受文机关中级别层次高的机关,抄送机关则必须是其中级别层次低的机关。()
我国古代历史上有不少由少数民族建立的政权,下列选项中对应正确的有()。
在回答伊拉克是否实际拥有大规模杀伤性武器或者只是曾试图获得这些武器时。美国总统布什称:“这有什么区别吗?如果他获得这些武器,他会变得更危险。他是‘9.11’事件,后美国应当解决掉的威胁。在12年这么长的时间里,世界一直在说他很危险,到现在我们才解决了这一危
简述使用TCP的连接释放方法可以保证不丢失数据的原因。
Theyencouragedoctorsto______cheapergenericdrugsinsteadofmoreexpensivebrandnames.
最新回复
(
0
)