首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
25
问题
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
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
LastThursday,theFrenchSenatepassedadigitalservicestax,whichwouldimposeanentirelynewtaxonlargemultinationalst
Thehumanbraincontains10thousandmillioncellsandeachofthesemayhaveathousandconnections.Suchenormousnumbersused
Thehumanbraincontains10thousandmillioncellsandeachofthesemayhaveathousandconnections.Suchenormousnumbersused
Thehumanbraincontains10thousandmillioncellsandeachofthesemayhaveathousandconnections.Suchenormousnumbersused
Adealisadeal—except,apparently,whenEntergyisinvolved.Thecompany,amajorenergysupplierinNewEngland,provokedjus
随机试题
请认真阅读下列材料,并按要求作答。动作方法:支撑脚脚尖正对来球,膝关节微屈,接球腿提膝稍外展,脚尖微翘,脚掌与地面平行,使脚内侧正对来球;当球滚到体前时,接球脚自然伸出迎球,触球的一刹那接球脚顺势后撤,以缓冲来球力量,将球接在脚下。请
下列应用中属于非线性高频电路的是()
机器设备重置成本的构成,包括()
市燃气公司在为张某安装煤气时要求张某购买其下属公司生产的燃气灶,否则不予安装。下列说法中正确的有:()
当测量值与平均值之差大于2倍标准差时,则该测量值应()。
张某于2015年初开办了一家酒楼,主要从事餐饮服务。2015年取得如下收入:(1)餐饮营业收入800000元(包括销售10吨自制啤酒取得的收入50000元);(2)出租酒楼内的柜台取得租金收入50000元,其中包括水费、电费4000元;(3)受托代销
通用的工作分析方法有( )等。
行政诉讼所要解决的纠纷一般发生在()。
人力资源的一般特点是()。
公共政策的评价方法有很多,其中成本效益分析方法的运用应遵循的基本原则有()。
最新回复
(
0
)