Download Data Connections

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IMDb wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Relational model wikipedia , lookup

Functional Database Model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Making the Connection
This set of instructions tells how to establish database sources for MS-Access, MS-Excel, an ODBC database
and text files for use with MS-Query.
MS-Access
Connections to MS-Access are done at the database file level.
Select Data -> From Other Data Sources -> MS-Query
Select MS-Access
Navigate to the folder containing the database, select the database and select the table or query within the
database.
NOTE: For MS-Query, it is advised to develop queries within the database rather than attempting to
develop them using the MS-Query builder. The only caveats are do not use MS-Access-specific
functions like NZ(), user defined functions or prompt for a parameter at run time.
Click on the ADD button and then close. In most cases the query can be displayed graphically.
Pull down the columns you wish to display. Pulling down * will get the columns in the order in which they
appear in the table or query.
Click on the doorway icon, and the data is returned to the sheet.
MS-Excel
Connections to MS-Excel are done at the spreadsheet file level.
Select Data -> From Other Data Sources -> MS-Query
Select MS-Excel
Navigate to the folder containing the spreadsheet, select the spreadsheet and select the sheet within the
database.
Click on the ADD button and then close. In most cases the query can be displayed graphically.
Pull down the columns you wish to display. Pulling down * will get the columns in the order in which they
appear in the table or query.
Click on the doorway icon, and the data is returned to the sheet.
ODBC Connections
Connections to other databases can be made using the Windows Control Panel or from within MS-Query itself.
Select Data -> From Other Data Sources -> MS-Query
Select <New Data Source>
Type in the name of the database and select the appropriate driver.
Enter the credentials for the database and OK out of the screens
The new data source now appears in the Choose Data Source dialog box and is ready for use.
Text Files
Connections to text files are done at the Windows directory level.
MS-Query can read from comma separated variable (CSV), tab-delimited files and fixed-length variable files.
Select Data -> From Other Data Sources -> MS-Query
Select <New Data Source>
Give the database a name and select Microsoft Text Driver (*.txt, *.csv).
Click off Use Current Directory and navigate to the directory containing the text files you wish to use.
Enter the credentials for the database and OK out of the screens
The new data source now appears in the Choose Data Source dialog box and is ready for use.
All text files within this directory and subdirectories are available for use
Advanced Topic – Text File Definitions
MS-Query works very well with CSV files and does a good job figuring out the data type and format of the
variable.
However, there are issues with tab-delimited and especially with fixed-length files. Sometimes it is even
desirable to define things in CSV files.
These interpretations are defined in a schema.ini file in the root directory of the data source. The schema.ini
file can be used to untangle data that is formatted in non-standard configurations.
This link contains the official documentation on the topic: https://msdn.microsoft.com/enus/library/ms709353(v=vs.85).aspx.
Each file to be used as a text data source can be defined in the schema.ini file. Each data file is defined by a
contiguous set of rows. Data file definitions are separated by one or more blank rows. Optional definitions that
are not exercised default to Windows registry settings.
There is no need to define each data file or column. Only files or columns requiring special interpretation need
to be defined.
[DataFileName]
Format=FormatType
ColumnNameHeader=TRUE/FALSE
MaxScanRows=n
DateTimeFormat=”datetimeformat”
Col1=“Column 1 Name” Type
Col2=“Column 2 Name” Type
…
Format Types can be:
 TabDelimited
 CSVDelimited
 Delimited(|) <- shown here is the pipe symbol, any single character can be used.
 FixedLength
ColumnNameHeader is either TRUE if the source has a header column or FALSE if it does not have a header
column.
MaxScanRows determines the number of rows to scan to determine the column type. It is optional. If it is not
in the definition or is set to zero, all rows will be scanned. It is superfluous if all columns are defined.
DateTimeFormat determines how to read dates. For example “yyyy-mm-dd hh:nn:ss” DateTimeFormat is
optional.
Type can be one of the following
 Bit
 Byte
 Short
 Long
 Currency
 Single (or Integer)





Double (or Float)
DateTime
Text (or Char) Width n (Width n is optional except for fixed length format)
Memo (or LongChar)
Date