|Applies to Infiniti v8.1 or later
Often the response from a stored procedure call via the Save to SQL Server Action is required for further calls. Most commonly the response is some sort of identifier created by the stored procedure for use in an on screen message, email, SMS etc.
After a successful Save to SQL Server Action is performed a response is returned to Infiniti that can be used by pending actions. Specifically this response is the first column of the first row in the result set returned by the query, additional columns and rows are ignored (also known as the executeScalar response).
For example in the following stored procedure the ID of the new record will be returned to Infiniti.
CREATE PROCEDURE spAddPerson
-- Add the parameters for the stored procedure here
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
INSERT INTO Person (firstName,surname)
SELECT @@IDENTITY AS 'Id';
The value can then be used by a reference with the following syntax:
e.g. [Save to SQL Server Database.Response]
In the example below the response will be displayed in a download page message. TIP this is a good method of testing your Save to SQL Server Actions.
Save to SQL Action
first name firstname add person