Passing N prefix to stored procedure variable

Posted on 2009-04-16
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)  
 SELECT   KPI_ID from dbo.tblKPI where KPI_DisplayText = @SKPI_DisplayText or KPI_Name_Czech = @SKPI_DisplayText

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?
Question by:Jeyakumar_mcp
    LVL 142

    Expert Comment

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

    LVL 1

    Author Comment

    Nope, am calling the sp from application. My question is to add N prefix inside the stored procedure. I tried adding single quote's by string concat.
    LVL 142

    Accepted Solution

    >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 side.

    Expert Comment

    by:ffhch bccv

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now