Link to home
Start Free TrialLog in
Avatar of Jeyakumar_mcp
Jeyakumar_mcp

asked on

Passing N prefix to stored procedure variable

In a table I have a column to hold kpi names in czech language. Column type is nvarchar.
Below sp will query the table to get kpi id.

ALTER PROC [dbo].[USP_GetKPiValue]  
@SKPI_DisplayText nvarchar(25)  
 
AS        
BEGIN  
 SELECT   KPI_ID from dbo.tblKPI where KPI_DisplayText = @SKPI_DisplayText or KPI_Name_Czech = @SKPI_DisplayText
END

But this query is not responding as expected. if I run the query with direct value like below, it works.
SELECT KPI_ID FROM  dbo.tblKPI where KPI_Name_Czech = N'Nevyu~itý as'
Can anybody give me a solution to add 'N' to the stored procedure variable?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

the procedure code is correct.
so, you need to call it like this:
exec [dbo].[USP_GetKPiValue]  N'Nevyu~it? as'

Open in new window

Avatar of Jeyakumar_mcp
Jeyakumar_mcp

ASKER

Nope, am calling the sp from Asp.net application. My question is to add N prefix inside the stored procedure. I tried adding single quote's by string concat.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
bcvbvb