首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
27
问题
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://jikaoti.com/ti/wwO7FFFM
本试题收录于:
微软70228题库微软认证分类
0
微软70228
微软认证
相关试题推荐
Severaltypesoffinancialriskareencounteredininternationalmarketing;themajorproblemsincludecommercial,political,an
Ofallthegoodsandservicestradedinthemarketeconomy,pharmaceuticalsareperhapsthemostcontentious.Thoughproducedby
[A]"Ijustdon’tknowhowtomotivatethemtodoabetterjob.We’reinabudgetcrunchandIhaveabsolutelynofinancialrewa
Writealettertoacompanydecliningajoboffer.Inyourletter,youshouldappreciatethejoboffer,andstateyourreason(s)
In2016,manyshoppersoptedtoavoidthefreneticcrowdsanddotheirholidayshoppingfromthecomfortoftheircomputer.But
TheU.S.PostalService(USPS)continuestobleedredink.Itreportedanetlossof$5.6billionforfiscal2016,the10thst
NextmonthBritonswillhaveyetmoresmartphonestochoosefrom,whendevicesfromWiko,atwo-year-oldFrenchcompany,goons
GivingmillionsofexistingPayPalcustomerstheabilitytobuyattheclickofabuttonhasenormouspotentialforincreasing
在用户管理组administrators中删除lusi用户。
通过【网上邻居】查找网上计算机和共享文件资源,IP为“202.204.54.23”,主机名为administrator,共享文件夹名为“tools”。
随机试题
沉井刃脚的垫层采用砂垫层上铺垫木方案时,下列说法错误的是()。
M公司是一家大型企业,多年来,随着实力的不断增强,其经营领域也在不断拓宽。进入21世纪,M公司与其他企业一样,面临着严峻的挑战。为了在竞争中立于不败之地,正确地进行经营战略和策略的选择,M公司对现有的各经营领域进行了综合分析。结果发现,公司经营的甲产品虽然
TheNationalTrusthasworkedforthepreservationofplacesofhistoricinterestandnaturalbeautyinEngland,WalesandNorth
下列属于工业固体废物的是()。
中外合资经营企业增加注册资本的决议,必须经出席董事会会议的董事一致通过。()
以下( )情况下不需要提交变更验资报告。下列( )情形需要注册会计师在验资报告的意见段后增加说明段予以说明。
张女士因夫妻关系不和十分痛苦,但又不想离婚。这时社会工作者合适的处理方式是()
TheBibleisthegreatworkofthereligiousliteratureandwasinprocessofformationforabouttwelvehundredyears.The
战略数据规划方法引入了主题数据库的重要概念,下列()是有关主题数据库的正确论述。
ASocioculturalApproachtoReading,LanguageandLiteracyI.ThemeaningoftakingasocioculturalapproachA.Itrejectsthe【
最新回复
(
0
)