Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prefix 'N' for the parameters in a store procedure for a unicode strings

How to prefix 'N' for the parameters in a store procedure for a unicode strings in c#, alternatively i am using the same procedure for the non unicode also. i need to append it only for the unicode ones kindly help.

like image 853
skamale Avatar asked Oct 13 '10 10:10

skamale


People also ask

What is N in stored procedure?

The N just tells the parser that the string literal should be or is a double-byte (unicode) string. Since your parameter is already of type NVARCHAR the parser knows that what it is.

What is N prefix in SQL?

The "N" prefix stands for National Language in the SQL-92 standard, and is used for representing Unicode characters. In the current standard, it must be an upper case , which is what you will typically find implemented in mainstream products.

What is Unicode character string in SQL?

A UNICODE character uses multiple bytes to store the data in the database. This means that using UNICODE it is possible to process characters of various writing systems in one document. This could be useful if you're working with an international character set (for example different languages).

How do you call a parameterized stored procedure?

Right-click the user-defined stored procedure that you want and select Execute Stored Procedure. In the Execute Procedure dialog box, specify a value for each parameter and whether it should pass a null value. Indicates the name of the parameter. Indicates the data type of the parameter.


1 Answers

You don't need to prefix N for parameters. This is only required for literals. Just make sure your stored procedure and ADO.NET parameters are of Unicode type (nvarchar or whatever).

like image 175
Martin Smith Avatar answered Sep 21 '22 16:09

Martin Smith