chergh
blah
- Local time
- Today, 23:54
- Joined
- Jun 15, 2004
- Messages
- 1,414
Hey folks,
I have a SQL backend database from which I extract data from. One of the tables I query is the auditlog table which I use to look at how long it takes tickets to move through a particular process. This is a reasonably large table with ~2 million rows. I only want to extract records which contain information relating to my companies Qlist process, I use an intermediate access database and then after a bit of manipulation in the access db I output it to excel. Ideally I would do this something like:
This just causes a "malloc" error to be returned. So instead I use this code.
This is slow as hell so does anyone have any suggestions on how to improve this?
Doing anything on the SQL Server database is a no no, the DBA just doesn't allow it.
I have a SQL backend database from which I extract data from. One of the tables I query is the auditlog table which I use to look at how long it takes tickets to move through a particular process. This is a reasonably large table with ~2 million rows. I only want to extract records which contain information relating to my companies Qlist process, I use an intermediate access database and then after a bit of manipulation in the access db I output it to excel. Ideally I would do this something like:
Code:
INSERT stuff INTO table WHERE ID IN (SELECT ID FROM otherTable)
This just causes a "malloc" error to be returned. So instead I use this code.
Code:
strSQL1 = "SELECT DISTINCT Incident_Number FROM tbl_qlist"
Set rs1 = db.OpenRecordset(strSQL1)
rs1.MoveFirst
Do While rs1.EOF = False
Set rs2 = db.OpenRecordset("SELECT Entry_ID FROM HPD_Help_Desk where Incident_Number = '" & rs1!incident_number & "'")
strEntryID = rs2!Entry_ID
strSQL2 = "INSERT INTO tbl_qlist_comp ( Incident_Number, Log_Field, Create_Date ) " & _
"SELECT '" & rs1!incident_number & "' AS Incident_Number, [Log] AS Log_Field, Create_Date " & _
"FROM HPD_HelpDesk_AuditLogSystem " & _
"WHERE (((HPD_HelpDesk_AuditLogSystem.Original_Request_ID)='" & strEntryID & "'))"
db.Execute (strSQL2)
rs1.MoveNext
Loop
This is slow as hell so does anyone have any suggestions on how to improve this?
Doing anything on the SQL Server database is a no no, the DBA just doesn't allow it.