Extracting Data from a Civica Resource Database
Total Page:16
File Type:pdf, Size:1020Kb
Extracting data from a Civica Resource database The process for extracting data from a Civica Resource accounting system requires a backup copy of the schools Civica SQL database. This is restored into an instance of SQL Server and then the database is queried to extract the relevant information. The tools required for this are an installation (the latest version is always preferable) of Microsoft SQL Server (Express version should be fine) and the accompanying version of SQL Server Management Studio to manage the SQL query and resulting output. Ensure the SQL Server installation is on the local workstation, and that the school database is located on the local workstation (SQL Server cannot backup or restore data using an external location). SQL Server Management Studio Open SQL Server Management Studio and sign into your local instance of SQL Server (the connection dialog may offer other server names that are available that have installed instances of SQL Server). You should see the Management Studio window containing the Object Explorer: The object explorer allow you to manage (create/delete/restore/etc..) a number of databases on your workstation. Selecting the ‘+’ next to Databases will expand the branch and show all databases you have access to. You can restore and have access to multiple databases on your workstation. To restore a database 1. Right click on the branch ‘Databases’ and from the menu select ‘Restore Database…’. This will produce a new dialog called ‘Restore Database - ‘: You will need to fill out the dialog as follows: a. Change Source from Database to Device: b. Select the ellipses button , you will see a new dialog called ‘Select backup devices’: c. Select the ‘Add’ button and then browse to and select your SQL backup database. At this point it is worth being aware that all SQL backup database files should end with the file type ‘.bak’. However, when you use SQL Server Management Studio to create the backup file it doesn’t force or automatically populate the file type. Additionally, SQL Server backup files can be large and in most instances they will compress very well in ZIP files. If the database you intend to restore is compressed or doesn’t have the correct file type it will not be available to select. You will also notice that the file browser only looks at the file structure of the machine where the instance of SQL you are using is installed. You cannot restore a SQL database from an external source (such as a different workstation or server). d. After selecting your SQL database backup file the selection dialog should look similar to this: e. Select OK. The SQL backup file will be checked to ensure it is valid and it is the correct version (a version newer than you SQL installation may be rejected). If you get an error at this stage, check the version of SQL you have installed and upgrade if required. f. If all goes well you should see something similar to the following: g. In the destination Database field you should see the name of the database what was used in the original SQL Server instance, i.e. it will probably be the same as the one shown above. To keep a track of multiple databases, and because you cannot have duplicate database names within one instance of SQL Server (you will overwrite the database that was there), it is HIGHLY recommended you rename the database to reflect the school that this data relates to: h. Select OK to proceed. The database will be created; the backup will be checked and processed. You should receive the message similar to the following: The object explorer will now contain your newly restored database: Problems you may encounter: You cannot restore data from a newer version of SQL than the instance you are restoring into. The error message doesn’t make this clear (SQL error messages are cryptic). A corrupted or compressed backup file will not restore (not even partially). If you want to restore a database with a duplicate name (one you already have) you need to select ‘Overwrite the existing database’ from within the Restore >> Options page. I do not recommend this procedure – I prefer to delete the original database first. Trying to overwrite a database without selecting this option first will result in an error. Extracting Civica Resource accounting data At this point you should have a database restored. It is recommended that you create an empty Excel spreadsheet, and copy the data (and keep for reference) into that empty spreadsheet. Once all data is extracted you can then close the SQL Server Management Studio and work on mapping the data across to the migration spreadsheet. The process of extracting the data involves executing a number of SQL queries on the Civica Resource database and copying the resulting data in your new Excel spreadsheet. Each query is setup and executed in exactly the same way: a. Open SQL Server Management Studio. b. From the toolbar, select New Query: This will open a new query window to the right of the Object Explorer: At this point check that the database you want to run the query against is selected in the SQL Editor Toolbar (as highlighted above). If it isn’t, use the dropdown to select the correct database. You can use the same SQLQuery window to run all the queries. Copy and paste each one separately into the query window and then ‘Execute’ each in turn. The queries are listed in the table at the end of this document. Repeat steps c to g to extract the data for each section. c. (As an example) Highlight and copy the query for Supplier Details. You need to select the full query (missing any part of the query, even a single character, will result in an error). d. Paste the query into the SQLQuery window: e. Select execute (as highlighted above). A new window will appear displaying the query results: You need to copy this information into your new spreadsheet. To do this… f. Left click in the top left corner of the query grid (highlighted with a red circle above). This will select the entire grid of data. Now right click on exactly the same place (the top left corner of the query grid, highlighted with a red circle above), and select Copy with Headers from the menu. g. In your spreadsheet, in cell A1, paste the data. You will see all the data resulting from the query including the header information that tells you what the columns of data relate to. You now need to repeat this query process for each of the sections. You can reuse the query window be removing the query pasted there earlier (which is my preference), or you can create a new query window. Paste the data into a new sheet within your spreadsheet and rename each sheet with the name for each section. This can then be used as a reference. Complete the data extraction process (most schools do not use analysis in Civica Resource so if the data window is blank or contains nothing of value, just skip to the next section) until all the data is in the spreadsheet. You can then use this as a basis to populate the migration spreadsheet. Keep a copy of the extracted data (your temporary spreadsheet) with the backup of the schools data until such time as both can be purged. Queries to be run against the database Section Query Supplier Details SELECT PLDescription.AccountCode, PLDescription.Description, PLDescription.Address1, PLDescription.Address2, PLDescription.Address3, PLDescription.Address4, PLDescription.Address5, PLDescription.PostCode, PLDescription.Email, PLDescription.Telephone, PLDescription.Bank_Name, PLDescription.SortCode, PLDescription.AcCode, PLDescription.CreditDays, PLDescription.Contact, PLDescription.VATReg, PLDescription.VATCode, PLDescription.NominalCode, PLDescription.CISNumber, PLDescription.CISType, PLDescription.CISExpiry, PLDescription.PayBacs, PLDescription.OnHold, PLDescription.Comment FROM PLDescription Customer Details SELECT SLDescription.AccountCode, SLDescription.Description, SLDescription.Address1, SLDescription.Address2, SLDescription.Address3, SLDescription.Address4, SLDescription.Address5, SLDescription.PostCode, SLDescription.Email, SLDescription.Telephone, SLDescription.Bank_Name, SLDescription.SortCode, SLDescription.AcCode, SLDescription.CreditDays, SLDescription.Contact, SLDescription.VATReg, SLDescription.VATCode, SLDescription.NominalCode, SLDescription.OnHold, SLDescription.Comment FROM SLDescription Ledger Codes SELECT NominalCode.NominalCode, NominalCode.Description FROM NominalCode Analysis Codes SELECT AnalysisCode.AnalysisCode, AnalysisCode.Description FROM AnalysisCode Budget Codes SELECT Department.DepartmentCode, Department.Description, Department.ParentDepartment FROM Department .