>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!


Barney wrote this stored procedure to manage inserts to his Sales table:
CREATE PROCEDURE InsertSale
@SalesPersonID int,
@ProductID int,
@Quantity int,
@CustomerID int
AS
If @Quantity > 0
Insert Sales (SalesPersonID, ProductID, Quantity, CustomerID)
VALUES (@SalesPersonID, @ProductID, @Quantity, @CustomerID)
else
RAISERROR ('Unable to enter negative or 0 quantity into Sales table.', 16, 1)
GO
What does the RAISERROR statement do?
   It provides feedback to the calling application so it can diagnose why the insert failed.
Barney wrote this stored procedure to manage inserts to his Sales table:
CREATE PROCEDURE InsertSale
@SalesPersonID int,
@ProductID int,
@Quantity int,
@CustomerID int
AS
If @Quantity > 0
Insert Sales (SalesPersonID, ProductID, Quantity, CustomerID)
VALUES (@SalesPersonID, @ProductID, @Quantity, @CustomerID)
else
RAISERROR ('Unable to enter negative or 0 quantity into Sales table.', 16, 1)
GO
If there are no constraints on the table, how can Barney make sure that the value of @SalesPersonID is valid?
   Check the table in which SalesPersonID is a Primary Key to ensure that the value is valid.
Barney wrote this stored procedure to manage inserts to his Sales table:
CREATE PROCEDURE InsertSale
@SalesPersonID int,
@ProductID int,
@Quantity int,
@CustomerID int
AS
If @Quantity > 0
Insert Sales (SalesPersonID, ProductID, Quantity, CustomerID)
VALUES (@SalesPersonID, @ProductID, @Quantity, @CustomerID)
else
RAISERROR ('Unable to enter negative or 0 quantity into Sales table.', 16, 1)
GO
Barney's boss found out about user-defined functions, and wants Barney to rewrite this as a user-defined function. What steps should Barney take to make this happen?
   This procedure cannot be rewritten as a function.
Bill wants to set up full-text searching on the Comments column of his OrderDetail table in the BillCo database. The OrderDetail table has a composite key made up of the OrderID and the ProductID field. Why won't this solution work?
   Because there is no single-column unique key for the table.