Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
RDBMS Stored Procedure Details : Interfacing with RDBMS stored procedures : Defining a view to use as a buffer : Technique to define a view to use as a buffer
 
Technique to define a view to use as a buffer
While a stored procedure can include multiple SQL statements, a buffer that you define contains the format of only a single results set. You need to define multiple views to accommodate multiple results sets.
To define a buffer:
1. Define a view in the MS SQL Server data source.
The data source must have the following characteristics:
*The naming convention _BUFFER_buffername
*The same number of columns and data types that the stored procedure returns in the results set
*The columns in the order that the stored procedure returns them
For example, to return two columns with two types of values, an integer and a character string, use a SQL utility to define the following view in the data source:
CREATE VIEW _BUFFER_custlist AS SELECT customer.cust_num,
  customer.name FROM customer WHERE 1 = 0
GO
Notice that these views are defined to ensure that they never return any results. This helps to indicate that the purpose of the view is its buffer content and not its SQL capabilities. It is not necessary to define views that you will use as buffers this way, but it does allow you to distinguish quickly between views and buffers.
2. Update your schema image using the Update/Add Table Definitions DataServer utility. The utility adds the view to the list of accessible objects in the schema holder. The DataServer defines the view as a buffer that OpenEdge can use. (See Updatinga schema holder for instructions on using this utility.)