SQL2008 存储过程参数相关

 

 使用inputparame时,使用的是 varchar(20),和数据库中的DEPARTNAME完全匹配,可以查出值:

 

SQL2008 存储过程参数相关
 1 USE [test]
 2 GO
 3 
 4 SET ANSI_NULLS OFF
 5 GO
 6 
 7 SET QUOTED_IDENTIFIER OFF
 8 GO
 9 
10 
11 ALTER PROCEDURE [dbo].[pro_testprocedure](@inputparame varchar(20))
12     
13 AS
14 
15 BEGIN
16     SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo
17     from his_depart
18 END
19 GO
Code1

 

 

 而使用inputparame时,使用的是 varchar时,却没用能够用过varindex得到值:

 

SQL2008 存储过程参数相关
 1 USE [test]
 2 GO
 3 
 4 SET ANSI_NULLS OFF
 5 GO
 6 
 7 SET QUOTED_IDENTIFIER OFF
 8 GO
 9 
10 
11 ALTER PROCEDURE [dbo].[pro_testprocedure](@inputparame varchar)
12     
13 AS
14 
15 BEGIN
16     SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo
17     from his_depart
18 END
19 GO
Code2

 

 

 

新手向 =。。=

SQL2008 存储过程参数相关,布布扣,bubuko.com

SQL2008 存储过程参数相关

上一篇:MySQL数据类型(四)


下一篇:Windows Internal Database Service Pack 4 x64 Edition (KB2463332)安装失败