首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
30
问题
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
微软认证
相关试题推荐
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
WhentheresidentsofBuenosAireswanttochangethepesostheydonottrustintothedollarstheydo,theygotoacueva,or"
SupposeyouphonedyourfriendMaryseveraltimesyesterdaybutshedidn’tansweryourcallatall.Writeheranemailto1
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
EricHansenwritesabouttravelasaparticipatingenthusiastratherthanamereobserver.【T1】Itgivesthesenineessays,based
Herearesomemanagementtoolsthatcanbeusedtohelpyouleadapurposefullife.1.UseYourResourcesWisely.Yourdecisi
MireilleGuiliano,achampagnecompanyexecutive,capturedtheattentionoffrustrateddieterswithherjoyoflifeinthe2005
InToday’smanagement-theoryindustry,reputation—oratleastthecorporatekind—isa"strategicasset"thatcanbe"leveraged"
GivingmillionsofexistingPayPalcustomerstheabilitytobuyattheclickofabuttonhasenormouspotentialforincreasing
随机试题
A、白芥子B、紫苏子C、辛夷D、合欢皮E、海桐皮表面具有棕红色椭圆形皮孔的药材为()
患者,男,62岁。2年前行“人工瓣膜置换术”,术后遵医嘱服用华法林。护士建议该患者日常生活中使用电动剃须刀剃须,主要目的是
纳税人()应向原税务登记机关办理注销税务登记。
2020年10月1日,甲公司向乙公司借款100万元,借款期限为1年,年利率8%。应债权人乙公司的要求,丙公司以其所有的H型精密仪器为该笔借款提供抵押担保,2020年11月1日,双方签订书面抵押合同,2020年11月11日,办理了抵押登记。同时,甲公司的关联
中华文化历史悠久,内涵丰富。能够代表中华文化的符号数量众多,其中最具有代表性的,一定非汉字莫属。这不仅是因为汉字是中华文化的载体,更是因为汉字本身就是中华文化不可或缺的组成部分。从她产生的那一刻起,汉字就担负起承载中华文化的重任。几千年来她与中华文化相伴而
新课程改革的具体目标有哪几项?
宽严相济政策中的“严格”是指()。
[①][②]处恰当的措辞是()。符合第3段文意的一项是()。
下列说法错误的是()。
A、Nottoobad.B、Sorrytohearit.C、You’rewelcome.D、Waitaminute.A考查“Howdid…go?”询问某事进展的回答。此句句意为“嗨,你的项目进展如何?”如果进展顺利,可以说Good
最新回复
(
0
)