After SQL Assistant (SQLA) v14.0 is updated, the History from the previous version is not automatically inserted to the SQLA History table created in Version 14.0. Because of this condition, the following manual work-around can be used, if recovery of the SQLA history is desired. Note: Your prior SQLA version’s history list has not been lost. J
-
Use Windows Explorer to navigate to the directory in which the SQLA History files are located:
-
This path is/should be [ C:\Users\<UserID>\My Documents\NCR\Queryman ]
-
Note: If the two files below are not found in the above path, an alternate path may be:
-
[ C:\Users\<UserID>\AppData\Roaming\Teradata\SQL Assistant ]
-
Two SQLA files should be present, which are:
-
[ queryman.MDB ] (Old History) and
-
[ SQLHistory.MDB ] (New/Current History- has been running since the v14.0 upgrade )
-
Note: If the extents of files are not observable and you wish to have the extents displayed, go to the appendix of this document, regarding the process to display/hide the extents of files.
- Next, begin the setup for importing your Old History into the New/Current History
-
Verify you are resident in path: [ C:\Users\<UserID>\My Documents\NCR\Queryman ]
-
The screen is shown below, as it desirably should appear (contact Quincy Leslie, if it does not)
-
-
Right click on the Directory window, somewhere below the two .MDB files
-
Hover over “New” , then slide right and up and click on “Microsoft Access Database”
-
A new MS Access database should appear with extent “accdb”, as shown below
-
You may right click on the database/file name and change it, such as to “sqla-transfer.accdb”, etc.
-
-
-
This new database will be used as a temporary work space.
- Open this database (“yourfilename.accdb”) by double-clicking it.
- MS Access is opened and the applications screen below will appear:
-
- Links: The next process will create links to the two History MDB files, which are MS Access tables
- Click header tab “External Data”, to obtain screen as per below
- Click the pink icon labeled “Access”, which brings up the “Get External Data – Access Database” screen
- Click the button “Link to the data source by creating a linked table.”
-
The screen will appear as below:
-
-
Next link to the two (2) tables, per the files named- See “Create the Links as follows” below:
-
queryman.MDB (old history)
-
SQLHistory.MDB (new/curr history)
-
Note: You will not import the databases – just create links.
- Create the Links as follows:
- Note: linked tables will be noted by a “+” marked before the table name, after linked
- Insert the path for the first file name into the “File name:” field.
-
Copy this next path inside the brackets and insert this path to “File name:” field
- [ C:\Users\<UserID>\Documents\NCR\Queryman ]
-
-
Change the <UserID> to your EmplID and click “Browse” and reach the folder Queryman.
-
Click on file name “queryman.MDB”
-
- [ queryman.MDB ] Old History Linking
- Single Click on the queryman .MDB file/table (old history) highlighting it, to prepare for linking,
- Click on the “Open” button
- The “External Data - Access Data” will pop up again, with the file name appended to the path
- See screen shot below.
- Ensure that the “Link to…” choice is clicked- see below
- Click the “OK” button, which links to the queryman .MDB
- The Linked Table panel will appear with “QTHIST” listed (if queryman.MDB was selected)
- The link is almost, but not yet, complete
- Please scroll further in this document
-
- Again, the Link Tables panel will appear with “QTHIST” listed, if queryman.MDB was linked.
-
-
Left click on the QTHIST item, highlighting it
-
Click the OK button
-
The queryman.MDB table/file has now been linked and appears as under Tables (see below)
-
It is still named QTHIST;
-
Please rename “QTHIST” to “oldhist”
-
Rename it by Right-Clicking and selecting “Rename” from the Drop down choices
-
Type in “oldhist”
-
-
The renamed table will appear as “oldhist”.
- [ SQLHistory.MDB ] / New History Link
-
To link to the SQLHistory.MDB table/file (New History), repeat the above process
-
Select SQLHistory.MDB, instead of queryman.MDB
- Please ensure that you click on “Link to…” in the “Get External Data – Access Database” panel
- Once you have linked to queryman.MDB, please rename to “newhist”
- After both tables are linked, the Access App screen should appear as:
-
- Review the content of each table
- Please review the content of both tables by double clicking on each table. Specifically, observe the number of rows in the newhist table, as found in the bottom of the screen:
- Make a note of the total records in newhist, before later appending the oldhist records.
- The appearance will be:
- Display “newhist” table
- Note1: usually the newhist row count will usually only be 20-200 rows
- note2: the newhist high count below is because it is after one of my test runs
-
-
-
- End newhist display
- Display “oldhist” table rows
-
-
- End oldhist display
- Preparing for Recovery of Old History
- Clear both the table row listings:
- Right Click on either table’s tab, oldhist or newhist
- Click on “Close All” from the drop down list (or close one at a time, if desired, via “Close”)
- Or---
- Click “X” in the upper RH corner, once for each Database name, until both are closed.
- If you tweaked the listing of either table, such as widening a column, the message below will appear
- The safest choice is to click “No”
-
- Both table’s row listings will be dropped
- Dropping Links and Re-Linking (optional)
- If, for whatever reason before recovery, you wish to drop the links and re-link either or both tables:
- Do as follows:
- Right Click on the table to be de-linked
-
- Right click on desired table name, as listed above
- Choose “delete” from the drop down choices (about the middle)
-
- Click Yes button to de-link.
- Undo De-Link: If you de-link inadvertently, you can undo that action by either:
- Ctrl-Z or press the Undo logo (blue back-circle logo)
- The table will return to a linked state
- You can always re-link, when desired (see instructions above in document).
- Recovery of Old History
- Recovery of the old history is run via SQL implemented with MS Access.
- The SQL is below:
- Create a new Query and change to SQL view,as follows:
- Click on the “Create” tab on the Access header
-
- Click on the “Query Design” icon above
- The “Show Table” panel will appear (see next page).
- Click on the “Close” button on that panel.
-
-
After “Close” button is pressed, a Header of tabs with a blank query screen will remain, per below:
-
The MS Access screen will appear, as in the screen shot below:
-
The tab “Query Tools” will be in a chosen state.
-
The tab “Query1” (in Peach) will have appeared over the blank panel.
-
The icon SQL View” will be displayed
-
-
- Press the “SQL View” logo (upper LH Corner, under “File” tab) icon and cause the SQL term “SELECT;” to appear and be highlighted. This means that SELECT; is in a state to be edited.
-
- Please become resident or remain resident in the Word Document and “Copy” the following SQL statement, under the “SQL Statement” heading on the next page (Ctrl-C, Copy, etc.) and within/between the row of equal signs “====….”
- (SQL is two pages down)
- After you copy the SQL, return to the MS Access screen and insert the SQL via “Right Click” and choose “Paste” from the choices.
- If you already inserted some SQL, the following screen will appear. Note that “SQL View” will have been replaced by the “View” icon. In that state, you can use Ctrl-V or Right-click, choose Paste to insert the SQL.
-
- After the insertion of SQL, the screen should appear as follows:
-
- SQL Statement (to copy and paste)
--=============================
INSERT INTO newhist (
EndDate, Source, Elapsed, RowCnt, ErrCd, Msg, Notes,
[SQL],
StmtCnt, StmtType, SQLType,
[User],
DBSTime, FetchTime, Seq
)
SELECT
[RUNDATE]+[RUNTIME] AS Expr4,
oldhist.ODBCDRV,
Format([ELTIME],"hh:nn:ss"".000""") AS Expr5,
oldhist.MAXROWS,
0 AS Expr1,
oldhist.SQLMESSAGE,
oldhist.SQLNOTES,
oldhist.SQLSTRING,
0 AS Expr2,
'' AS Expr3,
oldhist.SQLTYPE,
oldhist.ODBCUSER,
Format([DBMSTIME]," hh:nn:ss"".000""") AS Expr6,
Format([FETCHTIME]," hh:nn:ss"".000""") AS Expr7,
[QTCOUNTER]-(SELECT MIN(QTCOUNTER) FROM oldhist )
+1+(SELECT MAX(Seq) FROM oldhist ) AS Expr8
FROM oldhist;
--=================
-
Note: not totally “pretty” formatted, but can just copy as is.
-
This SQL is utilized “as is”, if you already have entries in the new History file. If your new History file is still empty, remove the text +(SELECT MAX(Seq) FROM oldhist ) from the SQL.
-
See Perform SQL Run below to execute the Query and the entries from the Old History file will be appended to the New History. You can then delete the Temporary database, after success is verified.
Perform SQL Run (about to append old history to new history)
Click on the “! Run” icon as in the screen below . The “Enter Parameter Value”, “Seq” panel will come up. Enter the number of records + “1” found in the “newhist” table into the Seq field. This will cause the Surrogate Sequential number for the records appended to newhist, to start at the current number of records in newhist + “1”. E.g., if newhist contains 100 records, then the first Sequential number of the records appended will be “101”.
Enter the newhist number of records + 1. Click OK. The SQL will run.
Validate SQL Run: The SQL may either run or fail with an error message. However, if there is no error message, it will not report back when complete. Wait 5-10 seconds and observe the content of newhist
Verify Content of “newhist” table link: After running the SQL, open the newhist table and all of both the old and new entries should be present. The number of records should equal the total of the oldhist records + the newhist records, that existed before running the SQL.
This ends the process to recover the Old History of SQL Assistant, by merging to the current history.
Verify the SQL History under SQL Assistant
If SQL Assistant is open, then close it. In any event, open/re-open SQL Assistant. It may require 10-15 seconds, as the updated history is accessed. Prior to your logging into one of the Teradata servers, the updated history will appear, e.g. as shown below:
This is the End of Recovering SQL Assistant History Instructions
After SQL Assistant (SQLA) v14.0 is updated, the History from the previous version is not automatically inserted to the SQLA History table created in Version 14.0. Because of this condition, the following manual work-around can be used, if recovery of the SQLA history is desired. Note: Your prior SQLA version’s history list has not been lost. J
--=============================
INSERT INTO newhist (
EndDate, Source, Elapsed, RowCnt, ErrCd, Msg, Notes,
[SQL],
StmtCnt, StmtType, SQLType,
[User],
DBSTime, FetchTime, Seq
)
SELECT
[RUNDATE]+[RUNTIME] AS Expr4,
oldhist.ODBCDRV,
Format([ELTIME],"hh:nn:ss"".000""") AS Expr5,
oldhist.MAXROWS,
0 AS Expr1,
oldhist.SQLMESSAGE,
oldhist.SQLNOTES,
oldhist.SQLSTRING,
0 AS Expr2,
'' AS Expr3,
oldhist.SQLTYPE,
oldhist.ODBCUSER,
Format([DBMSTIME]," hh:nn:ss"".000""") AS Expr6,
Format([FETCHTIME]," hh:nn:ss"".000""") AS Expr7,
[QTCOUNTER]-(SELECT MIN(QTCOUNTER) FROM oldhist )
+1+(SELECT MAX(Seq) FROM oldhist ) AS Expr8
FROM oldhist;
--=================
Perform SQL Run (about to append old history to new history)
Click on the “! Run” icon as in the screen below . The “Enter Parameter Value”, “Seq” panel will come up. Enter the number of records + “1” found in the “newhist” table into the Seq field. This will cause the Surrogate Sequential number for the records appended to newhist, to start at the current number of records in newhist + “1”. E.g., if newhist contains 100 records, then the first Sequential number of the records appended will be “101”.
Enter the newhist number of records + 1. Click OK. The SQL will run.
Validate SQL Run: The SQL may either run or fail with an error message. However, if there is no error message, it will not report back when complete. Wait 5-10 seconds and observe the content of newhist
Verify Content of “newhist” table link: After running the SQL, open the newhist table and all of both the old and new entries should be present. The number of records should equal the total of the oldhist records + the newhist records, that existed before running the SQL.
This ends the process to recover the Old History of SQL Assistant, by merging to the current history.
Verify the SQL History under SQL Assistant
If SQL Assistant is open, then close it. In any event, open/re-open SQL Assistant. It may require 10-15 seconds, as the updated history is accessed. Prior to your logging into one of the Teradata servers, the updated history will appear, e.g. as shown below:
This is the End of Recovering SQL Assistant History Instructions