Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
NavNav
Starting Member
2 Posts |
Posted - 2010-10-14 : 11:47:46
|
HiI need to use the N prefix to insert foreign characters but how do I add the N prefix to a sql paramter?? I know how to do this using a raw string but not with a parameter when using a stored proc.So this is the SQL that is working correctly;Declare @company_name as nvarchar(30)SET @company_name = N'gelbo'INSERT INTO companies (company_name) VALUES (@company_name)But how do I this when I have a stored proc with a parameter @company_name. I want to do something like this;CREATE PROCEDURE [dbo].[new_company_add]( @company_name nvarchar(30))ASBEGIN INSERT INTO companies (company_name) VALUES (N@company_name)ENDAny ideas??? Thank you. |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-10-14 : 11:57:33
|
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. So, no need for the N in the case you have shown above. |
 |
|
NavNav
Starting Member
2 Posts |
Posted - 2010-10-14 : 13:46:33
|
Thanks LampreyThat makes sense. It seems that my issue is that ColdFusion can't handle this when using a stored proc (although I'm looking into a possible solution through the CF Admin). A direct insert worked as expected.Thanks for the reply. |
 |
|
|
|
|