About 726,000 results
Open links in new tab
  1. How to assign an exec result to a sql variable?

    Feb 11, 2010 · To assign to your variable you simply can do something like: Declare @MyDate datetime; SET @MyDate = (SELECT DateValue FROM MyDateFunction(@MyParameter)); …

  2. Assign result of dynamic sql to variable - Stack Overflow

    You can use sp_executesql with output parameter. declare @S nvarchar(max) = 'select @x = 1' declare @xx int set @xx = 0 exec sp_executesql @S, N'@x int out', @xx out select @xx Result:

  3. SQL SERVER – Input and Output Parameter For Dynamic SQL

    Sep 15, 2022 · A parameter whose value is sent out of the stored procedure/function module and back to the calling PL/SQL block is known as an output parameter. A variable, not a constant, …

  4. How to return the output of stored procedure into a variable in sql ...

    Aug 15, 2012 · If you have a non integer value, or a number of scalar values, you can use output parameters. @a int output, @b varchar(50) output. select @a = 1, @b='hello' If you want to …

  5. Return Data From a Stored Procedure - SQL Server

    Dec 17, 2024 · There are three ways of returning data from a procedure to a calling program: result sets, output parameters, and return codes. This article provides information on the three …

  6. SQL Stored Procedure with Parameters and Return Values - SQL

    Feb 24, 2022 · The three output parameter names are @LastName, @Total_Orders, and @Total_Sales_Amount. Each output parameter must be followed by either of two keywords: …

  7. Stored Procedure With Input And Output Parameters In SQL

    This post is for the beginner to understand how to write and modify a SQL stored procedure with parameters and variables. We will try to include some “why & how” answers that many stored …

  8. OUTPUT clause (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 22, 2024 · Returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement. These results can be returned to the …

  9. sql server - SQL Stored Procedure with Output Parameter

    Oct 31, 2016 · Output parameters in stored procedures are useful for passing a value back to the calling T-SQL, which can then use that value for other things. Let's say you have a stored …

  10. How to use Output Parameters in a Stored Procedure? - w3resource

    Feb 12, 2025 · Learn how to create and execute a stored procedure in SQL that uses output parameters to return calculated results.