Problem with large numbers of data update with cursorSelect n random rows from SQL Server tableHow can a LEFT OUTER JOIN return more records than exist in the left table?SQL update query using joinsHow can I do an UPDATE statement with JOIN in SQL?SET NOCOUNT ON usageUpdate a table using JOIN in SQL Server?How do I UPDATE from a SELECT in SQL Server?Problem with SQL Server 2000 Cursor Not Fetching NEXTHow to make a cursor fasterCode inside SQL Cursor will only execute first FETCH

Multi tool use
How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?
Why are Marine Le Pen's possible connections with Steve Bannon something worth investigating?
How to plot a surface from a system of equations?
Print characters from list with a For-loop
Was Tyrion always a poor strategist?
Is it a good idea to teach algorithm courses using pseudocode instead of a real programming language?
How to fix "webpack Dev Server Invalid Options" in Vuejs
How could Dwarves prevent sand from filling up their settlements
Bash Read: Reading comma separated list, last element is missed
Why aren't satellites disintegrated even though they orbit earth within earth's Roche Limits?
Failing students when it might cause them economic ruin
Why would Thor need to strike a building with lightning to attack enemies?
DISTINCT NULL return single NULL in SQL Server
Bash - Execute two commands and get exit status 1 if first fails
Greek theta instead of lower case þ (Icelandic) in TexStudio
How do you play the middle D and F in this passage?
Addressing an email
How can I prevent Bash expansion from passing files starting with "-" as argument?
If you attack a Tarrasque while swallowed, what AC do you need to beat to hit it?
Why does snapping your fingers activate the Infinity Gauntlet?
How to choose the correct exposure for flower photography?
Is my company merging branches wrong?
Can I have a delimited macro with a literal # in the parameter text?
What were the "pills" that were added to solid waste in Apollo 7?
Problem with large numbers of data update with cursor
Select n random rows from SQL Server tableHow can a LEFT OUTER JOIN return more records than exist in the left table?SQL update query using joinsHow can I do an UPDATE statement with JOIN in SQL?SET NOCOUNT ON usageUpdate a table using JOIN in SQL Server?How do I UPDATE from a SELECT in SQL Server?Problem with SQL Server 2000 Cursor Not Fetching NEXTHow to make a cursor fasterCode inside SQL Cursor will only execute first FETCH
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I wrote a query. I am editing data from a registered table of about 37000 and updating it with a cursor. It goes wrong result when I exceed a certain number. This record count is about 12800-12900.
Does anyone have any idea why this is happening? I'm so confused.
Is there any possibility of a restriction when working with the cursor?

|
show 2 more comments
I wrote a query. I am editing data from a registered table of about 37000 and updating it with a cursor. It goes wrong result when I exceed a certain number. This record count is about 12800-12900.
Does anyone have any idea why this is happening? I'm so confused.
Is there any possibility of a restriction when working with the cursor?

Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17
|
show 2 more comments
I wrote a query. I am editing data from a registered table of about 37000 and updating it with a cursor. It goes wrong result when I exceed a certain number. This record count is about 12800-12900.
Does anyone have any idea why this is happening? I'm so confused.
Is there any possibility of a restriction when working with the cursor?

I wrote a query. I am editing data from a registered table of about 37000 and updating it with a cursor. It goes wrong result when I exceed a certain number. This record count is about 12800-12900.
Does anyone have any idea why this is happening? I'm so confused.
Is there any possibility of a restriction when working with the cursor?


asked Mar 23 at 18:31


Mehmet NvrsMehmet Nvrs
83
83
Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17
|
show 2 more comments
Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17
Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17
|
show 2 more comments
1 Answer
1
active
oldest
votes
BelgeNo = DocumentNo
CoKey = Company's unique number
Kapsam = type of document
Durumu = status (for document valid=1 invalid=0)
BitisTarihi = End date of the document
Original table has about 37000 records and mixed. I tried to group for 'CoKey' and 'Kapsam' the data in the original table with the following query.
SELECT A.ID, A.BelgeNo, A.CoKey, A.Kapsam, A.Durumu, A.BitisTarihi
FROM Sshyb A
INNER JOIN (SELECT CoKey, Kapsam
FROM Sshyb
GROUP BY CoKey, Kapsam
HAVING COUNT(*) > 1) B
ON A.CoKey = B.CoKey AND A.Kapsam = B.Kapsam
ORDER BY A.Kapsam, A.CoKey
But I may be making a mistake in this query. The number of records is about 25000 when the query runs coz of 'having'. (i have to do this for single records) anyway
Table: ibb.co/5YmPPDH
After that i have cases:
if CoKey = Kapsam
biggest 'end date' must be true, others must be false (in the group as selected in the picture)
if dates are before today all should be wrong in the group
if CoKey != Kapsam
Switch to other group and check same case
In order to do this, I use the cursor as in the query. I am trying to find the groups with the temporary table and update the above. But when it goes above about 12000 records, the update process does not work as I designed it. I am not receiving an error but the update is incorrect.
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
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%2f55317081%2fproblem-with-large-numbers-of-data-update-with-cursor%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
BelgeNo = DocumentNo
CoKey = Company's unique number
Kapsam = type of document
Durumu = status (for document valid=1 invalid=0)
BitisTarihi = End date of the document
Original table has about 37000 records and mixed. I tried to group for 'CoKey' and 'Kapsam' the data in the original table with the following query.
SELECT A.ID, A.BelgeNo, A.CoKey, A.Kapsam, A.Durumu, A.BitisTarihi
FROM Sshyb A
INNER JOIN (SELECT CoKey, Kapsam
FROM Sshyb
GROUP BY CoKey, Kapsam
HAVING COUNT(*) > 1) B
ON A.CoKey = B.CoKey AND A.Kapsam = B.Kapsam
ORDER BY A.Kapsam, A.CoKey
But I may be making a mistake in this query. The number of records is about 25000 when the query runs coz of 'having'. (i have to do this for single records) anyway
Table: ibb.co/5YmPPDH
After that i have cases:
if CoKey = Kapsam
biggest 'end date' must be true, others must be false (in the group as selected in the picture)
if dates are before today all should be wrong in the group
if CoKey != Kapsam
Switch to other group and check same case
In order to do this, I use the cursor as in the query. I am trying to find the groups with the temporary table and update the above. But when it goes above about 12000 records, the update process does not work as I designed it. I am not receiving an error but the update is incorrect.
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
add a comment |
BelgeNo = DocumentNo
CoKey = Company's unique number
Kapsam = type of document
Durumu = status (for document valid=1 invalid=0)
BitisTarihi = End date of the document
Original table has about 37000 records and mixed. I tried to group for 'CoKey' and 'Kapsam' the data in the original table with the following query.
SELECT A.ID, A.BelgeNo, A.CoKey, A.Kapsam, A.Durumu, A.BitisTarihi
FROM Sshyb A
INNER JOIN (SELECT CoKey, Kapsam
FROM Sshyb
GROUP BY CoKey, Kapsam
HAVING COUNT(*) > 1) B
ON A.CoKey = B.CoKey AND A.Kapsam = B.Kapsam
ORDER BY A.Kapsam, A.CoKey
But I may be making a mistake in this query. The number of records is about 25000 when the query runs coz of 'having'. (i have to do this for single records) anyway
Table: ibb.co/5YmPPDH
After that i have cases:
if CoKey = Kapsam
biggest 'end date' must be true, others must be false (in the group as selected in the picture)
if dates are before today all should be wrong in the group
if CoKey != Kapsam
Switch to other group and check same case
In order to do this, I use the cursor as in the query. I am trying to find the groups with the temporary table and update the above. But when it goes above about 12000 records, the update process does not work as I designed it. I am not receiving an error but the update is incorrect.
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
add a comment |
BelgeNo = DocumentNo
CoKey = Company's unique number
Kapsam = type of document
Durumu = status (for document valid=1 invalid=0)
BitisTarihi = End date of the document
Original table has about 37000 records and mixed. I tried to group for 'CoKey' and 'Kapsam' the data in the original table with the following query.
SELECT A.ID, A.BelgeNo, A.CoKey, A.Kapsam, A.Durumu, A.BitisTarihi
FROM Sshyb A
INNER JOIN (SELECT CoKey, Kapsam
FROM Sshyb
GROUP BY CoKey, Kapsam
HAVING COUNT(*) > 1) B
ON A.CoKey = B.CoKey AND A.Kapsam = B.Kapsam
ORDER BY A.Kapsam, A.CoKey
But I may be making a mistake in this query. The number of records is about 25000 when the query runs coz of 'having'. (i have to do this for single records) anyway
Table: ibb.co/5YmPPDH
After that i have cases:
if CoKey = Kapsam
biggest 'end date' must be true, others must be false (in the group as selected in the picture)
if dates are before today all should be wrong in the group
if CoKey != Kapsam
Switch to other group and check same case
In order to do this, I use the cursor as in the query. I am trying to find the groups with the temporary table and update the above. But when it goes above about 12000 records, the update process does not work as I designed it. I am not receiving an error but the update is incorrect.
BelgeNo = DocumentNo
CoKey = Company's unique number
Kapsam = type of document
Durumu = status (for document valid=1 invalid=0)
BitisTarihi = End date of the document
Original table has about 37000 records and mixed. I tried to group for 'CoKey' and 'Kapsam' the data in the original table with the following query.
SELECT A.ID, A.BelgeNo, A.CoKey, A.Kapsam, A.Durumu, A.BitisTarihi
FROM Sshyb A
INNER JOIN (SELECT CoKey, Kapsam
FROM Sshyb
GROUP BY CoKey, Kapsam
HAVING COUNT(*) > 1) B
ON A.CoKey = B.CoKey AND A.Kapsam = B.Kapsam
ORDER BY A.Kapsam, A.CoKey
But I may be making a mistake in this query. The number of records is about 25000 when the query runs coz of 'having'. (i have to do this for single records) anyway
Table: ibb.co/5YmPPDH
After that i have cases:
if CoKey = Kapsam
biggest 'end date' must be true, others must be false (in the group as selected in the picture)
if dates are before today all should be wrong in the group
if CoKey != Kapsam
Switch to other group and check same case
In order to do this, I use the cursor as in the query. I am trying to find the groups with the temporary table and update the above. But when it goes above about 12000 records, the update process does not work as I designed it. I am not receiving an error but the update is incorrect.
edited Mar 24 at 12:24
answered Mar 24 at 11:00


Mehmet NvrsMehmet Nvrs
83
83
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
add a comment |
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.
– Mehmet Nvrs
Mar 24 at 14:01
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%2f55317081%2fproblem-with-large-numbers-of-data-update-with-cursor%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
OJWPDVpxL,gcwj7CITgVhh2w wpHBMG8e4nUUNE5 Kjc B4gpXT wFoxkD a2WDWGAgt 4TxjKGQTSv0x
Table and query are too long. If you want to look at the codes I can send link.
– Mehmet Nvrs
Mar 23 at 18:34
Please provide relevant table layout, indeces and your SQL statement for proper analysis. Your row counts are probably not the problem.
– belwood
Mar 23 at 18:38
Codes: dipolpos.com/txt/SSHYB.txt
– Mehmet Nvrs
Mar 23 at 18:58
Table: ibb.co/5YmPPDH
– Mehmet Nvrs
Mar 23 at 18:59
You can print the values for all the records or just add try catch and on catch block print the all variables value then you able to find the exact problem. I think there is some data issue
– Adnan Ahmed Ansari
Mar 23 at 19:17