本文介绍了在将Clause传递给SP时,Sql server不搜索Unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sql中进行unicode搜索任务但面临问题。只是当我使用查询进行搜索时它工作得非常好

I am doing unicode searching task in sql but facing problem۔ simply when i doing search using query it is working very fine

select Hadith_Urdu
from Hadiths_old
where Hadith_Urdu like N'%حماد%'



以上查询搜索了超过1600条记录





我的SP执行与Where子句参数是下面给出


above query searched more then 1600 records
while

my SP execution with Where clause Parameter is below give

execute SPSearching @Mode ='Searching', @WhereClause= 'Hadith_Urdu Like N''%حماد%'''





和我的SP低于



and my SP is below

USE [SSDB2]

ALTER PROCEDURE [dbo].[SPSearching] 
	-- Add the parameters for the stored procedure here
	@Mode varchar(50),
	@WhereClause  Nvarchar(Max) = null
AS
if @Mode= 'ColumnNames'
BEGIN
	SELECT column_name FROM information_schema.columns WHERE table_name = 'Hadiths_old'
END

 
if @Mode= 'Searching'
BEGIN
declare @SQL VARCHAR(MAX)
 
SET @SQL='Select [Hadith_Text]
      ,[Hadith_Urdu]
      ,[Hadith_English]
      ,[Chapter_English_Name]
      ,[Chapter_Urdu_Name]
      ,[Baab_English_Name]
      ,[Baab_Urdu_Name]
      ,[Baab_Id]
      ,[Hadith_Book_Number]
       From Hadiths_old
       Where '
       IF @WhereClause<>''
       SET @SQL=@SQL+'  '+ @WhereClause + ' order by ID'
 
EXEC(@SQL)
END

推荐答案


这篇关于在将Clause传递给SP时,Sql server不搜索Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 01:00