13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

758 User-Defined Data 4 Chapter 26User-Defined DataYou can supplement the Sybase system data types by defining your own data typeswith the Sybase system procedure sp_addtype. When you define your own data type<strong>for</strong> a column, you can specify a default value (other than NULL) <strong>for</strong> the column anddefine a range of allowable values <strong>for</strong> the column.Sybase Null ValuesSybase has a special value that is called NULL. A This value indicates an absence ofin<strong>for</strong>mation and is analogous to a <strong>SAS</strong> missing value. When <strong>SAS</strong>/<strong>ACCESS</strong> reads aSybase NULL value, it interprets it as a <strong>SAS</strong> missing value.By default, Sybase columns are defined as NOT NULL. NOT NULL tells Sybase notto add a row to the table unless the row has a value <strong>for</strong> the specified column.If you want a column to accept NULL values, you must explicitly define it as NULL.Here is an example of a CREATE TABLE statement that defines all table columns asNULL except CUSTOMER. In this case, Sybase accepts a row only if it contains a value<strong>for</strong> CUSTOMER.create table CUSTOMERS(CUSTOMER char(8) not null,STATE char(2) null,ZIPCODE char(5) null,COUNTRY char(20) null,TELEPHONE char(12) null,NAME char(60) null,CONTACT char(30) null,STREETADDRESS char(40) null,CITY char(25) null,FIRSTORDERDATE datetime null);When you create a Sybase table with <strong>SAS</strong>/<strong>ACCESS</strong>, you can use the DBNULL= dataset option to indicate whether NULL is a valid value <strong>for</strong> specified columns.For more in<strong>for</strong>mation about how <strong>SAS</strong> handles NULL values, see “Potential ResultSet Differences When Processing Null Data” on page 31.To control how Sybase handles <strong>SAS</strong> missing character values, use the NULLCHAR=and NULLCHARVAL= data set options.LIBNAME Statement Data ConversionsThis table shows the default <strong>for</strong>mats that <strong>SAS</strong>/<strong>ACCESS</strong> Interface to Sybase assignsto <strong>SAS</strong> variables when using the LIBNAME statement to read from a Sybase table.These default <strong>for</strong>mats are based on Sybase column attributes.Table 26.4TypesLIBNAME Statement: Default <strong>SAS</strong> Formats <strong>for</strong> Sybase Server DataSybase Column Type <strong>SAS</strong> Data Type Default <strong>SAS</strong> FormatCHAR(n ) character $nVARCHAR(n ) character $nTEXT character $n. (where n is the value of theDBMAX_TEXT= option)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!