SQL Get stored procedure return data process analysis

SQL Get stored procedure return data process analysis

This article mainly introduces the analysis of the process of obtaining the returned data from the stored procedure in sql. The sample code in the article is very detailed and has a certain reference value for everyone's study or work. Friends in need can refer to it.

After executing the storage, the data of the stored procedure execution is obtained and used as a secondary function for other applications.

In fact, the code can be said to be similar to the call, the specific operations are as follows:

Create a stored procedure:

use [library name]
go
set ansi_null on
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE DBO.P_TEST
(
 @RBACK VARCHAR(20) OUT -- here out means what needs to be returned)
AS
BEGIN TRY
 SET @RBACK= (SELECT 2+2)
END TRY

The above script returns a result of 2+2 equals 4.

How to call it externally, or in other stored procedure scripts, is as follows:

declare @RBACK VARCHAR(20)
EXEC library name.dbo.P_TEST @REBACK OUT
SELECT @REBACK

Execution returns 4, so it can be used more flexibly.

It will be much more convenient in the later work.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Three ways to get the definition of SqlServer stored procedure
  • Analysis: PHP calls MsSQL stored procedure and uses built-in RETVAL to obtain the return value in the process
  • Detailed explanation of PHP calling MsSQL Server 2012 stored procedures to obtain multiple result sets (including output parameters)
  • Detailed explanation of how to get return value in dynamic SQL in MySQL stored procedure
  • SqlServer example of getting the return value of a stored procedure
  • SQL stored procedure to obtain the first letter of the Chinese character pinyin function
  • Calling a stored procedure in PostgreSQL and returning a dataset instance
  • delphi mysql adbquery data provider or other services return E_FAIL status
  • SQL returns the affected row data after adding data
  • Return all table names, column names, data type notes of a database in Mysql

<<:  Windows Server 2019 IIS10.0+PHP(FastCGI)+MySQL Environment Construction Tutorial

>>:  A complete record of the process of building mobile applications using Vue Native

Recommend

How to install Nginx in CentOS

Official documentation: https://nginx.org/en/linu...

How to enable remote access permissions in MYSQL

1. Log in to MySQL database mysql -u root -p View...

How to install PostgreSQL11 on CentOS7

Install PostgreSQL 11 on CentOS 7 PostgreSQL: The...

Ubuntu 20.04 turns on hidden recording noise reduction function (recommended)

Recently, when using kazam in Ubuntu 20.04 for re...

How to deploy Redis 6.x cluster through Docker

System environment: Redis version: 6.0.8 Docker v...

How to design and create adaptive web pages

With the popularization of 3G, more and more peop...

Simple web design concept color matching

(I) Basic concepts of web page color matching (1) ...

How to implement variable expression selector in Vue

Table of contents Defining the HTML structure Inp...

Example test MySQL enum type

When developing a project, you will often encount...

Understanding and example code of Vue default slot

Table of contents What is a slot Understanding of...

JavaScript timer to achieve seamless scrolling of pictures

This article shares the specific code of JavaScri...

Mysql8.0 uses window functions to solve sorting problems

Introduction to MySQL Window Functions MySQL has ...

Several practical scenarios for implementing the replace function in MySQL

REPLACE Syntax REPLACE(String,from_str,to_str) Th...