sqlserver 2008 存储过程 sqlserver2008存储过程输入参数简单例子讲解? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CREATE PROC test_inputproc@input intASBEGIN IF @input=1 PRINT '@input='+CAST(@input AS VARCHAR(10)) ELSE PRINT '@input<>1' ENDEXEC test_inputproc 1EXEC test_inputproc 2[code]@input=1@input<>1[/code] create procedure test_proc --创建存储过程 test_proc@dept varchar(10) --输入参数@deptasbegin --语句开始select * from test4 where dept=@dept -- 查询test4表中dept=输入参数@dept的所有记录end --语句结束--------------------------------------------------------exec test_proc '行政部' --执行存储过程 test_proc 输入参数为 行政部----结果--------------------------------------------------id dept date----------- ---------- -----------------------2 行政部 2014-07-18 15:16:35.5403 行政部 2014-08-03 14:04:15.58038 行政部 2014-07-10 20:06:35.34040 行政部 2014-08-20 09:04:18.41046 行政部 2014-08-27 14:13:01.23052 行政部 2014-08-20 09:04:18.41059 行政部 2014-08-27 14:13:19.833(7 行受影响) CREATE PROCEDURE protest @input intASBEGIN set @input= @input +1 SELECT @inputENDGOexec protest 1结果是2 请教一个查询语句 数据导入 自动截断问题。 求一个触发器的写法 关于自动删除数据库 !!高分跪求一存储过程,根据参数值的不同读取不同字段的值,并返回读取内容 求教:订阅发布视图和存储过程,复制出错。报:订阅服务器上不存在对象 case when 条件不定 @xx=null 出错问题。 历史问题,再次拿出来问。 关于sql2000中链接服务器(Linker)的创建问题,高手请进 MFC与SQL相连的问题 安装CMS 提示access denied for user odbc@localhost(using password:no)
CREATE PROC test_inputproc
@input int
AS
BEGIN
IF @input=1
PRINT '@input='+CAST(@input AS VARCHAR(10))
ELSE
PRINT '@input<>1'
ENDEXEC test_inputproc 1
EXEC test_inputproc 2
[code]
@input=1
@input<>1
[/code]
create procedure test_proc --创建存储过程 test_proc
@dept varchar(10) --输入参数@dept
as
begin --语句开始
select * from test4 where dept=@dept -- 查询test4表中dept=输入参数@dept的所有记录
end --语句结束
--------------------------------------------------------
exec test_proc '行政部' --执行存储过程 test_proc 输入参数为 行政部
----结果--------------------------------------------------
id dept date
----------- ---------- -----------------------
2 行政部 2014-07-18 15:16:35.540
3 行政部 2014-08-03 14:04:15.580
38 行政部 2014-07-10 20:06:35.340
40 行政部 2014-08-20 09:04:18.410
46 行政部 2014-08-27 14:13:01.230
52 行政部 2014-08-20 09:04:18.410
59 行政部 2014-08-27 14:13:19.833(7 行受影响)
CREATE PROCEDURE protest
@input int
AS
BEGIN
set @input= @input +1
SELECT @input
END
GO
exec protest 1结果是2