ODBC Database Sources (SAVE TRANSLATE command)
The following rules apply when writing to a database
with TYPE=ODBC
:
- If you specify a table name that does not exist in the database, a new table with that name is created.
- If any case cannot be stored in the database for any reason, an error is returned. Therefore, either all cases are stored or no cases are stored.
- At insert time, a check is performed to see whether the value that is being stored in a column is likely to cause an overflow. If so, the user is warned about the overflow and is informed that a SYSMIS is stored instead.
- If any variable names in the active dataset contain
characters that are not allowed by the database, they are replaced
by an underscore. If this process causes a duplicate variable name,
a new variable name is generated.
By default, IBM® SPSS® Statistics variable formats are mapped to database field types based on the following general scheme. Actual database field types may vary, depending on the database.
Table 1. Format conversion for databases IBM SPSS Statistics Variable Format Database Field Type Numeric Float or Double Comma Float or Double Dot Float or Double Scientific Notation Float or Double Date Date or Datetime or Timestamp Datetime Datetime or Timestamp Time, DTime Float or Double (number of seconds) Wkday Integer (1–7) Month Integer (1–12) Dollar Float or Double Custom Currency Float or Double String Char or Varchar - For database Datetime/Timestamp formats that don't allow fractional seconds, fraction seconds in IBM SPSS Statistics Datetime values are truncated.
- The default width of Char database data types for IBM SPSS Statistics string variables is the defined width of the string variable. If the defined width of the string exceeds the maximum width allowed by the database, the values are truncated to the maximum width, and a warning is issued.
- You can override the default settings by using the SQL subcommand to create or update tables. See the topic SQL Subcommand (SAVE TRANSLATE command) for more information.