?
Solved

Passing N prefix to stored procedure variable

Posted on 2009-04-16
4
Medium Priority
?
1,817 Views
Last Modified: 2016-10-20
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?
0
Comment
Question by:Jeyakumar_mcp
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24157386
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

0
 
LVL 1

Author Comment

by:Jeyakumar_mcp
ID: 24157459
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.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 total points
ID: 24157568
>My question is to add N prefix inside the stored procedure.

you "cannot", resp you don't need. the parameter is declared nvarchar, which does the job from the procedure side.

the problem must be on the asp.net side.
0
 

Expert Comment

by:ffhch bccv
ID: 41851590
bcvbvb
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question