Feeding Other Systems


I guarantee that once word gets around that there's a database with student, test, and historical information, you'll get requests to pull data and load it into a spreadsheet or something similar. Because most programs will accept a comma-delimited file, all you have to do is create an output file with commas between each field, and either a single or double quote for the character or non-numeric data. Here's a sample script:

 rem Script to create a comma-delimited file rem from the student records rem for use in office spreadsheets. set heading off set pagesize 0 set feedback off set echo off SPOOL C:\STUDENT_SSN.DAT graphics/1_icon.gif  T  SELECT ''''L_NAME''''','SSNUM graphics/2_icon.gif FROM STUDENTS; SPOOL OFF; 

(1) The spool file will have the comma-delimited output.

(2) Check the notes below on the use of single and double quotes. The rules are quite strict.

What you have to remember is that there are rules for quotes: If you need a single quote, you have to use four single quotes to get one. If you need a double quote, you must do this: '"' that is, a single quote then a double quote then a single quote. Notice that the comma is also put in single quotes.

Here's the output file for the sample script I just showed you:

'Randolph',123456789 [3]

'Williams',222222222

'Cohen',111111111

'Champagne',333333333

'Klien',444444444

'Sanpletic',555555555

'Levin',666666666

'Corsu',777777777

[3] Notice the comma after the name and the single quotes around the name .

So go ahead, pull all the data that anyone needs from any of the tables. Just be mindful of getting your quotation marks straight!



Guerrilla Oracle
Guerrilla Oracle: The Succinct Windows Perspective
ISBN: 0201750775
EAN: 2147483647
Year: 2003
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net