N before object/table name etc in system stored procedure
I am fully understand the role of the N' before - by example - like N'%K' when we put query to nvarchar column, but I definitely don't understand why it's required (?), when it comes to name of the object in system stored procedure. I have book T-Sql fundamentals by Itzik Ben Gan and I see this code:
exec sys.sp_help
@objname = N'Sales.Orders';
or
exec sys.sp_help
@table_name = N'Orders',
@table_owner = N'Sales';
Why do we need to put the N before objname?
sql sql-server
|
show 1 more comment
I am fully understand the role of the N' before - by example - like N'%K' when we put query to nvarchar column, but I definitely don't understand why it's required (?), when it comes to name of the object in system stored procedure. I have book T-Sql fundamentals by Itzik Ben Gan and I see this code:
exec sys.sp_help
@objname = N'Sales.Orders';
or
exec sys.sp_help
@table_name = N'Orders',
@table_owner = N'Sales';
Why do we need to put the N before objname?
sql sql-server
1
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16
|
show 1 more comment
I am fully understand the role of the N' before - by example - like N'%K' when we put query to nvarchar column, but I definitely don't understand why it's required (?), when it comes to name of the object in system stored procedure. I have book T-Sql fundamentals by Itzik Ben Gan and I see this code:
exec sys.sp_help
@objname = N'Sales.Orders';
or
exec sys.sp_help
@table_name = N'Orders',
@table_owner = N'Sales';
Why do we need to put the N before objname?
sql sql-server
I am fully understand the role of the N' before - by example - like N'%K' when we put query to nvarchar column, but I definitely don't understand why it's required (?), when it comes to name of the object in system stored procedure. I have book T-Sql fundamentals by Itzik Ben Gan and I see this code:
exec sys.sp_help
@objname = N'Sales.Orders';
or
exec sys.sp_help
@table_name = N'Orders',
@table_owner = N'Sales';
Why do we need to put the N before objname?
sql sql-server
sql sql-server
asked Nov 26 '18 at 8:36
KarolKarol
63
63
1
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16
|
show 1 more comment
1
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16
1
1
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16
|
show 1 more comment
0
active
oldest
votes
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%2f53477288%2fn-before-object-table-name-etc-in-system-stored-procedure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53477288%2fn-before-object-table-name-etc-in-system-stored-procedure%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
1
What makes you think it's somehow different to what you already fully understand?
– Damien_The_Unbeliever
Nov 26 '18 at 8:43
Oh, so it's all about the name of the table etc can be in Unicode, so just to 'prevent' we use N before actual name? Well, to be honest, I thought that you can't name table, schema name etc with charcters which are not part of the Latin1_General.
– Karol
Nov 26 '18 at 8:49
Yep, check the rules for Regular Identifiers (And the rest of that page for info regarding collations)
– Damien_The_Unbeliever
Nov 26 '18 at 9:20
Oh, so looks like sometimes I try to overcomplicate things, but it's so simple. Thanks, have a nice day!
– Karol
Nov 26 '18 at 9:25
@Karol . . . If it is any consolation, I don't understand why it is required either. It would seem that SQL Server should be able to convert the string to a unicode string. Apparently, though, that is not something the parser does.
– Gordon Linoff
Nov 26 '18 at 12:16