所以,觉得有必要记录下来,这样以后再次碰到这类问题,也能从中获取解答的思路。
1、SQL 数据库中的存储过程的参数问题
http://bbs.csdn.net/topics/390640511?page=1#post-396062228
怎么将SQL数据库中的存储过程中的参数既作为输出变量又作为输出变量?
- --drop proc proc_test
- --go
-
-
- create proc dbo.proc_test
- @in int,
- @out int out,
- @in_out int output
- as
-
- select @out = @in + @in_out, --1 + 2 = 3
- @in_out = @out + 1 --3 + 1 = 4
- go
-
-
- declare @in_p int
- declare @out_p int
- declare @in_out_p int
-
- set @in_p = 1;
- set @in_out_p = 2
-
- exec dbo.proc_test @in_p,
- @out_p out,
- @in_out_p output
-
-
- select @in_p, --输入参数
- @out_p, --输出参数
- @in_out_p --输入,输出参数
- /*
- (无列名) (无列名) (无列名)
- 1 3 4
- */
2、在存储过程中的参数问题。
在论坛中出现的比较难的sql问题:14(存储过程问题 存储过程参数、存储过程内的参数)
原文:https://www.cnblogs.com/lonelyxmas/p/12020003.html