We use SQL Server 2005. All data access is through stored procedures. Our stored selection procedures always return multiple result sets.
For example:
CREATE PROCEDURE hd_invoice_select(@id INT) AS
SELECT * FROM Invoice WHERE InvoiceID = @id
SELECT * FROM InvoiceItem WHERE InvoiceID = @id
SELECT * FROM InvoiceComments WHERE InvoiceID = @id
RETURN
Our level of access to application data creates a graph of objects based on the results (O / R map style).
The problem is that we have many different options for choosing an invoice. They all return the same structure, only for different selection criteria. For example, I also have:
CREATE PROCEDURE hd_invoice_selectAllForCustomer(@customerID INT) AS
SELECT * FROM Invoice WHERE CustomerID = @customerID
SELECT * FROM InvoiceItem WHERE InvoiceID IN
(SELECT InvoiceID FROM Invoice WHERE CustomerID = @customerID)
SELECT * FROM InvoiceComments WHERE InvoiceID = @id
(SELECT InvoiceID FROM Invoice WHERE CustomerID = @customerID)
RETURN
and I have many others, including:
hd_invoice_selectActive()
hd_invoice_selectOverdue()
hd_invoice_selectForMonth(@year INT, @month INT)
and I have the same model for many concepts (Clients, Employees, etc.)
, . "" , procs, .
, : ?
, . . , , .