Link to home
Create AccountLog in
Avatar of splanton
splantonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Classic ASP returning a value from a SQl Server Stored procedure into VBScript variable

I have a SQL Server 2008 Stored procedure that looks like this:

create procedure [dbo].[usp_NewOrderReference]
(@NewOrderReference Char(10) OUTPUT)
AS

BEGIN
	
	SET @NewOrderReference = (SELECT 'ORD' + RIGHT ('0000000' + CAST(OrderNumber AS VARCHAR (10)),7) FROM [OrderReference])
	
	UPDATE OrderReference Set OrderNumber = (OrderNumber +1)
	
END

Open in new window


I am trying to call the Stored procedure from ASP like this:

<%
	SQLStmt = "exec.dbo.usp_NewOrderReference '';"
	Set RS_Result01 = Connection01.Execute(SQLStmt)

%>

Open in new window


It runs just fine (as you would expect).

The question is: How do i get the resulting NewOrderReference back into a VBScript variable for use on the page?
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of splanton

ASKER

Thanks for that.

Actual syntax I used  to test was :

<%
      SQLStmt = "exec.dbo.usp_NewOrderReference '';"
      Set RS_Result01 = Connection01.Execute(SQLStmt)
      v_neworderreference = RS_Result01(0)
      response.write("New order reference = "+ v_neworderreference)
%>