<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi Graeme , You can try this in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90201#M40462</link>
    <description>Hi Graeme , You can try this but not sure it will work or not.Thanks
Deaclare @outRequestID Bitint
INSERT INTO ABCD.TABCD
 ( [Surname]
 ,[DateOfBirth]
 )
 VALUES
 ( @insurName
 ,@indateOfBirth
 )
 SET @outRequestID = SCOPE_IDENTITY()
'------------------------------------'
Select (@outRequestID)
'------------------------------------'
OR
'------------------------------------'
Return (@outRequestID )
'------------------------------------'</description>
    <pubDate>Wed, 28 Sep 2016 11:43:00 GMT</pubDate>
    <dc:creator>anson_nelson_lo</dc:creator>
    <dc:date>2016-09-28T11:43:00Z</dc:date>
    <item>
      <title>Return values from a stored procedure insert</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90196#M40457</link>
      <description>Hi,

Does anyone know how we can return values from a stored procedure that is doing an insert ?

The table we are insert to has an INDENTITY field, which increments with each insert. We want to pass that back to Blue Prism, so we can use that when accessing the table further down the line.

The stored procedure is set up as follows:

	INSERT INTO ABCD.TABCD
		(  [Surname]
		  ,[DateOfBirth]
				)
			VALUES
				(	 @insurName
					,@indateOfBirth
				)
	SET @outRequestID = SCOPE_IDENTITY()

From Blue Prism, we are using the 'Data - SQL Server' object', but cannot get it to retrieve the @outRequestID return from the SP and pass it back to the calling process.

Has anyone managed to do this ?</description>
      <pubDate>Mon, 26 Sep 2016 18:25:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90196#M40457</guid>
      <dc:creator>Graeme__Tacon</dc:creator>
      <dc:date>2016-09-26T18:25:00Z</dc:date>
    </item>
    <item>
      <title>Hi Graeme - You'd have to</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90197#M40458</link>
      <description>Hi Graeme - You'd have to look up the syntax, but from memory SQL has a variable called @@Identity that gets automatically set on each insert.</description>
      <pubDate>Mon, 26 Sep 2016 21:38:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90197#M40458</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2016-09-26T21:38:00Z</dc:date>
    </item>
    <item>
      <title>Thanks John.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90198#M40459</link>
      <description>Thanks John.
We know the Stored Procedure I've posted above is working and getting the value we want. What we can't work out, is how Blue Prism can pick that value up.</description>
      <pubDate>Tue, 27 Sep 2016 14:50:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90198#M40459</guid>
      <dc:creator>Graeme__Tacon</dc:creator>
      <dc:date>2016-09-27T14:50:00Z</dc:date>
    </item>
    <item>
      <title>Hi Graeme - you might have to</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90199#M40460</link>
      <description>Hi Graeme - you might have to add a new page to the SQL business object to enable it to call a SP. Something along the lines of this:
Using conn As New SqlConnection(connect)
  Using cmd As New SqlCommand(query, conn)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.Parameters.AddWithValue(""@Category"", Category.Text)
    cmd.Parameters.Add(""@CategoryID"", SqlDbType.Int, 0, ""CategoryID"")
    cmd.Parameters(""@CategoryID"").Direction = ParameterDirection.Output
    conn.Open()
    cmd.ExecuteNonQuery()
    ID = cmd.Parameters(""@CategoryID"").Value
  End Using
End Using</description>
      <pubDate>Tue, 27 Sep 2016 15:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90199#M40460</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2016-09-27T15:01:00Z</dc:date>
    </item>
    <item>
      <title>Thanks</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90200#M40461</link>
      <description>Thanks</description>
      <pubDate>Tue, 27 Sep 2016 18:13:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90200#M40461</guid>
      <dc:creator>Graeme__Tacon</dc:creator>
      <dc:date>2016-09-27T18:13:00Z</dc:date>
    </item>
    <item>
      <title>Hi Graeme , You can try this</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90201#M40462</link>
      <description>Hi Graeme , You can try this but not sure it will work or not.Thanks
Deaclare @outRequestID Bitint
INSERT INTO ABCD.TABCD
 ( [Surname]
 ,[DateOfBirth]
 )
 VALUES
 ( @insurName
 ,@indateOfBirth
 )
 SET @outRequestID = SCOPE_IDENTITY()
'------------------------------------'
Select (@outRequestID)
'------------------------------------'
OR
'------------------------------------'
Return (@outRequestID )
'------------------------------------'</description>
      <pubDate>Wed, 28 Sep 2016 11:43:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Return-values-from-a-stored-procedure-insert/m-p/90201#M40462</guid>
      <dc:creator>anson_nelson_lo</dc:creator>
      <dc:date>2016-09-28T11:43:00Z</dc:date>
    </item>
  </channel>
</rss>

