使用inputparame时,使用的是 varchar(20),和数据库中的DEPARTNAME完全匹配,可以查出值:
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 AS14 15 BEGIN16 SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo17 from his_depart18 END19 GOCode1
而使用inputparame时,使用的是 varchar时,却没用能够用过varindex得到值:
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 AS14 15 BEGIN16 SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo17 from his_depart18 END19 GOCode2
新手向 =。。=
新闻热点
疑难解答