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

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;








0















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?










share|improve this question






















  • 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


















0















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?










share|improve this question






















  • 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














0












0








0








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?










share|improve this question














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?







sql-server tsql






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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













1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer

























  • Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.

    – Mehmet Nvrs
    Mar 24 at 14:01











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
);



);













draft saved

draft discarded


















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









0














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.






share|improve this answer

























  • Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.

    – Mehmet Nvrs
    Mar 24 at 14:01















0














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.






share|improve this answer

























  • Guys i solved the problem i was my silly fault. Sorry about that. Thanks for your comments.

    – Mehmet Nvrs
    Mar 24 at 14:01













0












0








0







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript