hi,
I am creating a simple bug tracker application (in Access db) and i
created a hisotry table to
log the bug history.
The history table contains details like ProblemRecordNo (PRN),
RecordStatus, Assignee, Reporter (and also some more columns). The PK
for this table is ID. It contains multiple entries for a Record.
I have inserted a lot of records int History table and now I introduced
two new fields into History table. They are PreviousStatus and
PreviousAssignee. I wanted to update the previous values of the Status
and Assignee for each record.
Say my History table contains values like
ID PRN Status Assignee
1 10 Report UserA
2 10 InProcess UserA
3 10 Esclated UserB
Now after introducing the Previous fields, the History table should
look like
ID PRN Status Assignee PreviousStatus PreviousAssignee
1 10 Report UserA
2 10 InProcess UserA Report UserA
3 10 Esclated UserB InProcess UserA
In the first record the PreviousStatus and PreviousAssignee are empty
bse there is no previous values for those two items. the next two
records contain the previous values of the status and assignee.
I used the following sql statement to update the table, but I get a
script time out error
UPDATE (
SELECT H.PRN, H.ID, H.PREVIOUSSTATUS AS OLDSTATUS, N.STATUS AS
NEWSTATUS,
H.PREVIOUSASSIGNEE AS OLDASSIGNEE, N.ASSIGNEE AS NEWASSIGNEE FROM
HISTORY H,
(SELECT N.ID, N.PRN, N.STATUS, N.ASSIGNEE FROM HISTORY N ) N
WHERE H.PRN = N.PRN AND N.ID < H.ID AND N.ID IN
(SELECT MAX(M.ID) FROM HISTORY M WHERE M.ID < H.ID AND H.PRN = M.PRN) )
SET OLDSTATUS = NEWSTATUS,
OLDASSIGNEE = NEWASSIGNEE
Is there anyother way i could update the table with a optimized query
that doesnt take time to update large set of rows.
:(
devi 5 2572
"devi" <de******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... hi,
I am creating a simple bug tracker application (in Access db) and i created a hisotry table to log the bug history.
The history table contains details like ProblemRecordNo (PRN), RecordStatus, Assignee, Reporter (and also some more columns). The PK for this table is ID. It contains multiple entries for a Record.
I have inserted a lot of records int History table and now I introduced
two new fields into History table. They are PreviousStatus and PreviousAssignee. I wanted to update the previous values of the Status and Assignee for each record.
Say my History table contains values like
ID PRN Status Assignee 1 10 Report UserA 2 10 InProcess UserA 3 10 Esclated UserB
Now after introducing the Previous fields, the History table should look like
ID PRN Status Assignee PreviousStatus PreviousAssignee 1 10 Report UserA 2 10 InProcess UserA Report UserA 3 10 Esclated UserB InProcess UserA
In the first record the PreviousStatus and PreviousAssignee are empty bse there is no previous values for those two items. the next two records contain the previous values of the status and assignee.
I used the following sql statement to update the table, but I get a script time out error
UPDATE ( SELECT H.PRN, H.ID, H.PREVIOUSSTATUS AS OLDSTATUS, N.STATUS AS NEWSTATUS, H.PREVIOUSASSIGNEE AS OLDASSIGNEE, N.ASSIGNEE AS NEWASSIGNEE FROM HISTORY H, (SELECT N.ID, N.PRN, N.STATUS, N.ASSIGNEE FROM HISTORY N ) N WHERE H.PRN = N.PRN AND N.ID < H.ID AND N.ID IN (SELECT MAX(M.ID) FROM HISTORY M WHERE M.ID < H.ID AND H.PRN = M.PRN) )
SET OLDSTATUS = NEWSTATUS, OLDASSIGNEE = NEWASSIGNEE
Is there anyother way i could update the table with a optimized query that doesnt take time to update large set of rows.
:(
devi
A script timeout error? Are you doing this with an ASP page or something?
Can you not work directly with the mdb file on your pc?
While SQL statements generally give the best performance, I would guess that
it would be quicker to create a recordset and loop through all the records.
Each time you come to a new prn you blank out PreviousStatus and
PreviousAssignee and store the Status and Assignee. Moving to the next
record you see if it is the same prn and if so put your stored fields into
the current fields and grab the current values for Status and Assignee.
I would guess this would be quite quick, but how many records are we talking
about?
"devi" <de******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... hi,
I am creating a simple bug tracker application (in Access db) and i created a hisotry table to log the bug history.
The history table contains details like ProblemRecordNo (PRN), RecordStatus, Assignee, Reporter (and also some more columns). The PK for this table is ID. It contains multiple entries for a Record.
I have inserted a lot of records int History table and now I introduced
two new fields into History table. They are PreviousStatus and PreviousAssignee. I wanted to update the previous values of the Status and Assignee for each record.
Say my History table contains values like
ID PRN Status Assignee 1 10 Report UserA 2 10 InProcess UserA 3 10 Esclated UserB
Now after introducing the Previous fields, the History table should look like
ID PRN Status Assignee PreviousStatus PreviousAssignee 1 10 Report UserA 2 10 InProcess UserA Report UserA 3 10 Esclated UserB InProcess UserA
In the first record the PreviousStatus and PreviousAssignee are empty bse there is no previous values for those two items. the next two records contain the previous values of the status and assignee.
I used the following sql statement to update the table, but I get a script time out error
UPDATE ( SELECT H.PRN, H.ID, H.PREVIOUSSTATUS AS OLDSTATUS, N.STATUS AS NEWSTATUS, H.PREVIOUSASSIGNEE AS OLDASSIGNEE, N.ASSIGNEE AS NEWASSIGNEE FROM HISTORY H, (SELECT N.ID, N.PRN, N.STATUS, N.ASSIGNEE FROM HISTORY N ) N WHERE H.PRN = N.PRN AND N.ID < H.ID AND N.ID IN (SELECT MAX(M.ID) FROM HISTORY M WHERE M.ID < H.ID AND H.PRN = M.PRN) )
SET OLDSTATUS = NEWSTATUS, OLDASSIGNEE = NEWASSIGNEE
Is there anyother way i could update the table with a optimized query that doesnt take time to update large set of rows.
:(
devi
A script timeout error? Are you doing this with an ASP page or something?
Can you not work directly with the mdb file on your pc?
While SQL statements generally give the best performance, I would guess that
it would be quicker to create a recordset and loop through all the records.
Each time you come to a new prn you blank out PreviousStatus and
PreviousAssignee and store the Status and Assignee. Moving to the next
record you see if it is the same prn and if so put your stored fields into
the current fields and grab the current values for Status and Assignee.
I would guess this would be quite quick, but how many records are we talking
about?
I am using ASP page.
Yes, I update Previous values as when i insert a new record in
History..
but the existing records..? so this query is to update the existing
History records with the previous values of status and assignee,
"devi" <de******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com... I am using ASP page. Yes, I update Previous values as when i insert a new record in History..
but the existing records..? so this query is to update the existing History records with the previous values of status and assignee,
As I understand it, you have made a design change to the database schema and
as a one-off change, you will have to change the table structure and
populate it with data. This is something you need to do once, not as a
regular routine, right?
Now although I didn't write the code for you, what I am suggesting you do is
not update via a single SQL statement, but instead create a recordset
variable and loop through it in the way I described. Do you understand what
I mean?
Also, as this is a big structural change, I would take the site down for
maintainence, download the mdb to your pc and do the update there rather
than trying to do the update via the ASP web page.
"devi" <de******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com... I am using ASP page. Yes, I update Previous values as when i insert a new record in History..
but the existing records..? so this query is to update the existing History records with the previous values of status and assignee,
As I understand it, you have made a design change to the database schema and
as a one-off change, you will have to change the table structure and
populate it with data. This is something you need to do once, not as a
regular routine, right?
Now although I didn't write the code for you, what I am suggesting you do is
not update via a single SQL statement, but instead create a recordset
variable and loop through it in the way I described. Do you understand what
I mean?
Also, as this is a big structural change, I would take the site down for
maintainence, download the mdb to your pc and do the update there rather
than trying to do the update via the ASP web page. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
I have 2 tables, one with names, and another with addresses, joined by their
CIVICID number (unique to the ADDRESSINFO table) in Oracle.
I need to update a field in the NAMEINFO table for a...
|
by: Lauren Quantrell |
last post by:
In VBA, I constructed the following to update all records in
tblmyTable with each records in tblmyTableTEMP having the same
UniqueID:
UPDATE
tblMyTable RIGHT JOIN tblMyTableTEMP ON...
|
by: Karen Middleton |
last post by:
In MS Access I can do in one SQL statement a update if exists else a
insert.
Assuming my source staging table is called - SOURCE and my target
table is called - DEST and both of them have the...
|
by: pb648174 |
last post by:
I have a single update statement that updates the same column multiple
times in the same update statement. Basically i have a column that
looks like .1.2.3.4. which are id references that need to...
|
by: 001 |
last post by:
Hello,
The select statement needs only 1 second to complete the query.
But the update statement spends 30 minutes. Why?
SELECT STATEMENT:
declare @IDate smalldatetime
select @IDate=col001...
| |
by: Mike Leahy |
last post by:
Hello all,
This question is related to updating tables - is there any way to calculate or
update the values in a column in a table to the values in a field produced by
a query result? An...
|
by: amitbadgi |
last post by:
HI i am getting the foll error while conv an asp application to
asp.net
Exception Details: System.Runtime.InteropServices.COMException: Syntax
error in UPDATE statement.
Source Error:
Line...
|
by: FayeC |
last post by:
I really need help figuring this out.
i have a db with mostly text fields but 2.
The user_id field is an autonumber (key) and the user_newsletter is a
number (1 and 0) field meaning 1 yes the ...
|
by: Steve |
last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement
I got ASP error number 13 when I use the SELECT...FOR UPDATE statement
as below.
However, if I use SELECT statement without...
|
by: Michel Esber |
last post by:
Hi all,
DB2 V8 LUW FP 15
There is a table T (ID varchar (24), ABC timestamp). ID is PK.
Our application needs to frequently update T with a new value for ABC.
update T set ABC=? where ID...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |