What is the purpose of putting an 'N' in front of function parameters in TSQL? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!why does t-sql use the N prefix for nvarchar string literals?Update SQL field with special charactersWhat is the meaning of the prefix N in T-SQL statements?How do I write a create table query that makes a unicode supporting table, in SMSS?How can I prevent SQL injection in PHP?Is there a Max function in SQL Server that takes two values like Math.Max in .NET?How do I create a unique constraint that also allows nulls?When should I use cross apply over inner join?Update function in TSQL triggerSQL Server query - Selecting COUNT(*) with DISTINCTSQL Server: How to Join to first rowUsing group by on multiple columnsCOALESCE Function in TSQLwhat is a “window descriptor” in tsql window function
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
Trademark violation for app?
How does the math work when buying airline miles?
Do I really need recursive chmod to restrict access to a folder?
また usage in a dictionary
Why aren't air breathing engines used as small first stages?
How to find all the available tools in mac terminal?
How would a mousetrap for use in space work?
How could we fake a moon landing now?
Does classifying an integer as a discrete log require it be part of a multiplicative group?
Most bit efficient text communication method?
why is Nikon 1.4g better when Nikon 1.8g is sharper?
How can I use the Python library networkx from Mathematica?
Is "Reachable Object" really an NP-complete problem?
How to write this math term? with cases it isn't working
Generate an RGB colour grid
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
Can a party unilaterally change candidates in preparation for a General election?
What does the "x" in "x86" represent?
Why are both D and D# fitting into my E minor key?
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
What does this Jacques Hadamard quote mean?
Is there any way for the UK Prime Minister to make a motion directly dependent on Government confidence?
Compare a given version number in the form major.minor.build.patch and see if one is less than the other
What is the purpose of putting an 'N' in front of function parameters in TSQL?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!why does t-sql use the N prefix for nvarchar string literals?Update SQL field with special charactersWhat is the meaning of the prefix N in T-SQL statements?How do I write a create table query that makes a unicode supporting table, in SMSS?How can I prevent SQL injection in PHP?Is there a Max function in SQL Server that takes two values like Math.Max in .NET?How do I create a unique constraint that also allows nulls?When should I use cross apply over inner join?Update function in TSQL triggerSQL Server query - Selecting COUNT(*) with DISTINCTSQL Server: How to Join to first rowUsing group by on multiple columnsCOALESCE Function in TSQLwhat is a “window descriptor” in tsql window function
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
What is the purpose of putting an 'N' in front of function parameters in TSQL?
For example, what does the N
mean in front of the function parameter in the following code:
object_id(N'dbo.MyTable')
sql sql-server tsql
add a comment |
What is the purpose of putting an 'N' in front of function parameters in TSQL?
For example, what does the N
mean in front of the function parameter in the following code:
object_id(N'dbo.MyTable')
sql sql-server tsql
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10
add a comment |
What is the purpose of putting an 'N' in front of function parameters in TSQL?
For example, what does the N
mean in front of the function parameter in the following code:
object_id(N'dbo.MyTable')
sql sql-server tsql
What is the purpose of putting an 'N' in front of function parameters in TSQL?
For example, what does the N
mean in front of the function parameter in the following code:
object_id(N'dbo.MyTable')
sql sql-server tsql
sql sql-server tsql
asked Mar 15 '10 at 15:21
Ben McCormackBen McCormack
19k44121201
19k44121201
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10
add a comment |
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10
add a comment |
1 Answer
1
active
oldest
votes
It indicates a "nationalized" a.k.a. unicode string constant.
http://support.microsoft.com/kb/239530
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
nchar
andnvarchar
Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.
nchar(n)
Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for
nchar
are national char and national character.
nvarchar(n)
Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for
nvarchar
are national char varying and national character varying.
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2448203%2fwhat-is-the-purpose-of-putting-an-n-in-front-of-function-parameters-in-tsql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It indicates a "nationalized" a.k.a. unicode string constant.
http://support.microsoft.com/kb/239530
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
nchar
andnvarchar
Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.
nchar(n)
Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for
nchar
are national char and national character.
nvarchar(n)
Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for
nvarchar
are national char varying and national character varying.
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
add a comment |
It indicates a "nationalized" a.k.a. unicode string constant.
http://support.microsoft.com/kb/239530
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
nchar
andnvarchar
Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.
nchar(n)
Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for
nchar
are national char and national character.
nvarchar(n)
Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for
nvarchar
are national char varying and national character varying.
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
add a comment |
It indicates a "nationalized" a.k.a. unicode string constant.
http://support.microsoft.com/kb/239530
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
nchar
andnvarchar
Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.
nchar(n)
Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for
nchar
are national char and national character.
nvarchar(n)
Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for
nvarchar
are national char varying and national character varying.
It indicates a "nationalized" a.k.a. unicode string constant.
http://support.microsoft.com/kb/239530
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".
http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx
nchar
andnvarchar
Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.
nchar(n)
Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for
nchar
are national char and national character.
nvarchar(n)
Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for
nvarchar
are national char varying and national character varying.
edited Feb 11 '12 at 7:29
answered Mar 15 '10 at 15:22
Joe KobergJoe Koberg
18k63649
18k63649
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
add a comment |
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
1
1
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
That's interesting. I always wondered why 'N' stood for 'Unicode', and why they didn't just use 'U'
– JohnFx
Mar 15 '10 at 15:27
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
@JohnFx: Just a guess, but I would bet that it was that 'U' has historically meant unsigned.
– Austin Salonen
Mar 15 '10 at 15:32
8
8
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
Nationalized text was in the SQL92 standard before unicode existed.
– Joe Koberg
Mar 15 '10 at 15:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2448203%2fwhat-is-the-purpose-of-putting-an-n-in-front-of-function-parameters-in-tsql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of What is the meaning of the prefix N in T-SQL statements?
– KyleMit
Aug 14 '18 at 22:10