Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i am passing where clause to store procedure execution. and searching Urdu language word
SQL
execute SPSearching @Mode ='Searching', @WhereClause= 'Hadith_Urdu Like N''%عبد%'''

but it doesnt provide me result whilc the serached word is present in database specified column

while my sp is
SQL
USE [SSDB2]
GO
/****** Object:  StoredProcedure [dbo].[SPSearching]    Script Date: 03/01/35 11:20:12 ص ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Name
-- Create date: 
-- Description:	
-- =============================================
ALTER PROCEDURE [dbo].[SPSearching] 
	-- Add the parameters for the stored procedure here
	@Mode varchar(50),
	@WhereClause  varchar(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

if i try to search english word then it is searching very fine.
SQL
execute SPSearching @Mode ='Searching', @WhereClause= 'Hadith_English Like N''%allah%'''


but i dont know it not working with unicode i have prefixed my searched word with N but not working
Posted

1 solution

you need to change the @WhereClause parameter datatype varchar to Nvarchar
and also check the following
Quote:
Hadith_Urdu columns datatype to nvarchar
 
Share this answer
 
Comments
Muhamad Faizan Khan 16-Nov-13 8:56am    
my 5 will check an accept it Thanks
Muhamad Faizan Khan 18-Nov-13 11:13am    
it is not searching i have changed to nvarchar
Muhamad Faizan Khan 18-Nov-13 11:15am    
unicode not searching
Thava Rajan 19-Nov-13 4:18am    
what is the criteria you searched

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900