使用inputparame时,使用的是 varchar(20),和数据库中的DEPARTNAME完全匹配,可以查出值:
USE [test]
GO SET ANSI_NULLS OFF
GO SET QUOTED_IDENTIFIER OFF
GO ALTER PROCEDURE [dbo].[pro_testprocedure](@inputparame varchar(20)) AS BEGIN
SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo
from his_depart
END
GO
Code1
而使用inputparame时,使用的是 varchar时,却没用能够用过varindex得到值:
USE [test]
GO SET ANSI_NULLS OFF
GO SET QUOTED_IDENTIFIER OFF
GO ALTER PROCEDURE [dbo].[pro_testprocedure](@inputparame varchar) AS BEGIN
SELECT DEPARTNAME, charindex( @inputparame, DEPARTNAME) as indexNo
from his_depart
END
GO
Code2
新手向 =。。=