Handle nested SQL statements in SQL Server
My procedure has large query syntax, many "nested if else" when I create it on one SQL Server I get this error:
Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
but when I create that on another server, it is created without error. I know the procedure has poor performance but why that is created correctly on another server
Does it depend on server config or database feature ?
sql
add a comment |
My procedure has large query syntax, many "nested if else" when I create it on one SQL Server I get this error:
Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
but when I create that on another server, it is created without error. I know the procedure has poor performance but why that is created correctly on another server
Does it depend on server config or database feature ?
sql
1
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48
add a comment |
My procedure has large query syntax, many "nested if else" when I create it on one SQL Server I get this error:
Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
but when I create that on another server, it is created without error. I know the procedure has poor performance but why that is created correctly on another server
Does it depend on server config or database feature ?
sql
My procedure has large query syntax, many "nested if else" when I create it on one SQL Server I get this error:
Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
but when I create that on another server, it is created without error. I know the procedure has poor performance but why that is created correctly on another server
Does it depend on server config or database feature ?
sql
sql
edited Jan 1 at 9:05
marc_s
578k12911161261
578k12911161261
asked Jan 1 at 7:32
shaghayeghshaghayegh
136
136
1
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48
add a comment |
1
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48
1
1
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48
add a comment |
1 Answer
1
active
oldest
votes
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
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%2f53993788%2fhandle-nested-sql-statements-in-sql-server%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
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
add a comment |
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
add a comment |
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
edited Jan 1 at 7:38
answered Jan 1 at 7:35
Zaynul Abadin TuhinZaynul Abadin Tuhin
14.1k21032
14.1k21032
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
add a comment |
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
1
1
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
While this may answer the technical question, it is not really a fix for the underlying error.
– Tim Biegeleisen
Jan 1 at 7:38
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
thanks , yes exactly ,i check the version of my SQL Server it is "Microsoft SQL Server 2014 - 12.0.2000.8 (X64)" The stored procedure is created correctly after this version,but in this version this sp can not create
– shaghayegh
Jan 2 at 6:52
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
but the version is higher than 2012sp1
– shaghayegh
Jan 2 at 6:53
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
support.microsoft.com/en-us/help/3058865/…
– shaghayegh
Jan 2 at 7:18
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%2f53993788%2fhandle-nested-sql-statements-in-sql-server%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
I think the bigger issue here is that seeing this error on any version of SQL Server might indicate poor code design. You might want to include the offending code in your question.
– Tim Biegeleisen
Jan 1 at 7:35
Please, we need to see the code qo we can make it run on every instance. Edit your question and add the code please.
– Sami
Jan 1 at 7:42
Please edit your question and fix your typo then provide more info your environment, also attach your query, what do you mean by "another server"? you mean another sql server instance or another version of MSSQL?
– amin10043
Jan 1 at 7:48