模糊查询实例 只要相关匹配即可

ALTER PROCEDURE [reg].[Proc_CheckRepProject]
( 
    @ProjectNm nvarchar(200) --项目NM
)
AS
BEGIN
    DECLARE @key varchar(1000) 
    SELECT TOP 1  @key = ProjectId FROM ProjectInfo 
    WHERE 
        CHARINDEX(ProjectNm, @ProjectNm) <> 0
        OR
        CHARINDEX(@ProjectNm,ProjectNm) <> 0
    SELECT * FROM ProjectInfo WHERE ProjectId=@key
END

 

posted @ 2014-02-12 10:27  吻上明天  阅读(287)  评论(0编辑  收藏  举报