>Concorsi
>Forum
>Bandi/G.U.
 
 
 
 
  Login |  Registrati 
Elenco in ordine alfabetico delle domande di 70-229: SQL Server 2000 database design and implementation

Seleziona l'iniziale:
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

> Clicca qui per scaricare l'elenco completo delle domande di questo argomento in formato Word!


Carol wants to distribute the Personnel table, but needs to leave out a couple of columns from the replication, such as the AnnualSalary column. What's the best way to do this?
   Use vertical partitioning to turn off replication for that article.
Choose all the SELECT statements that will return the au_fname column as 'Name'.

Choose 3.
   SELECT au_fname as ‘Name’ FROM Authors
Choose all the SELECT statements that will return the au_fname column as 'Name'.

Choose 3.
   SELECT ‘Name’ = au_fname FROM Authors
Choose all the SELECT statements that will return the au_fname column as 'Name'.

Choose 3.
   SELECT au_fname ‘NAME’ FROM Authors
Choose all the statements that you could use in the WHERE clause to find only the rows where the first name is Bobby or Bobbi.

Choose all that apply.
   WHERE name = ‘Bobby’ or name = ‘Bobbi’
Choose all the statements that you could use in the WHERE clause to find only the rows where the first name is Bobby or Bobbi.

Choose all that apply.
   WHERE name LIKE ‘Bobb[iy]’
Choose the statement that best describes a clustered index
   The leaf pages of the index are the data pages of the table.
Choose the statement that best describes a composite index.
   It contains multiple columns in its key.
Company news is stored in a table named News, which is located in the corporate database. The script that was used to create the News table is shown below:

CREATE TABLE News ( NewsID int NOT NULL, NewsText varchar (8000) NOT NULL, EmployeePositionType char (15) NOT NULL, DisplayUntil datetime NOT NULL, DateAdded datetime NOT NULL DEFAULT (getdate( )), CONSTRAINT PK_News PRIMARY KEY (NewsID) )

Users of the intranet need to view data in the news table, but do not need to insert, update, or delete data in the table. You need to deliver only the appropriate data to the intranet, based on the employee's position type. What should you do?   Create a stored procedure that returns the rows that apply to a specified position type.

Consider the following table and trigger definitions:
Table1:
UserID int IDENTITY
FirstName char(50)
LastName char(50)
DepartmentID int
BillingID int

CREATE TRIGGER Table1_InsertUpdate
ON Table1
FOR INSERT, UPDATE
AS
BEGIN
IF UPDATE(DepartmentID)
IF (Select count(*) from Table1 inner join Deleted on Table1.DepartmentID = deleted.departmentid) = 0
BEGIN
RAISERROR ('Cannot remove the last member from a department.', 16, 1)
ROLLBACK

END
END

What does the ROLLBACK statement in the trigger do?
   It causes the transaction containing the offending statement to roll back.
Consider the following table and trigger definitions:
Table1:
UserID int IDENTITY
FirstName char(50)
LastName char(50)
DepartmentID int
BillingID int

CREATE TRIGGER Table1_InsertUpdate
ON Table1
FOR INSERT, UPDATE
AS
BEGIN
IF UPDATE(DepartmentID)
IF (Select count(*) from Table1 inner join Deleted on Table1.DepartmentID = deleted.departmentid) = 0
BEGIN
RAISERROR ('Cannot remove the last member from a department.', 16, 1)
ROLLBACK

END
END

What does the RAISERROR statement in the trigger do?
   It provides the connection with an error message.
Consider the following table and trigger definitions:
Table1:
UserID int IDENTITY
FirstName char(50)
LastName char(50)
DepartmentID int
BillingID int

CREATE TRIGGER Table1_InsertUpdate
ON Table1
FOR INSERT, UPDATE
AS
BEGIN
IF UPDATE(DepartmentID)
IF (Select count(*) from Table1 inner join Deleted on Table1.DepartmentID = deleted.departmentid) = 0
BEGIN
RAISERROR ('Cannot remove the last member from a department.', 16, 1)
ROLLBACK

END
END

Assuming that this is the only trigger bound to the table, is it possible for the last member of a department to be deleted?
   Yes, by using the DELETE command.
Consider the following table and trigger definitions:
Table1:
UserID int IDENTITY
FirstName char(50)
LastName char(50)
DepartmentID int
BillingID int

CREATE TRIGGER Table1_InsertUpdate
ON Table1
FOR INSERT, UPDATE
AS
BEGIN
IF UPDATE(DepartmentID)
IF (Select count(*) from Table1 inner join Deleted on Table1.DepartmentID = deleted.departmentid) = 0
BEGIN
RAISERROR ('Cannot remove the last member from a department.', 16, 1)
ROLLBACK

END
END

Assuming that nested trigger is turned on, how could this trigger be modified to set the BillingID to 1 if the department is successfully changed?
   Adding an ELSE clause to the IF SELECT statement makes the appropriate update.
CREATE PROCEDURE Update Inventory @ Int ID int As Begin DECLARE @ COUNT int BEGIN TRANS SELECT @ Count = Available From Inventory with (Hold Lock) WHERE Inventory ID = @ Int ID IF ( @ Count >0) UPDATE Inventory SET Available = Count - 1 Where Inventory ID = @ Int ID COMMIT TRANS END   Change Table hint to UPDATE
CREATE PROCEDURE Update Inventory @ Int ID int As Begin DECLARE @ COUNT int BEGIN TRANS SELECT @ Count = Available From Inventory with (Hold Lock) WHERE Inventory ID = @ Int ID IF ( @ Count >0) UPDATE Inventory SET Available = Count - 1 Where Inventory ID = @ Int ID COMMIT TRANS END   Remove table hint