103 lines
6.1 KiB
HTML
103 lines
6.1 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Get catalog information about a column" />
|
||
|
<meta name="abstract" content="The SYSCOLUMNS view contains a row for each column of every table and view in the schema." />
|
||
|
<meta name="description" content="The SYSCOLUMNS view contains a row for each column of every table and view in the schema." />
|
||
|
<meta name="DC.subject" content="examples, catalog, getting column information, getting information about, column, getting catalog information about" />
|
||
|
<meta name="keywords" content="examples, catalog, getting column information, getting information about, column, getting catalog information about" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafydbcat.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafycatcol" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Get catalog information about a column</title>
|
||
|
</head>
|
||
|
<body id="rbafycatcol"><a name="rbafycatcol"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Get catalog information about a column</h1>
|
||
|
<div><p>The SYSCOLUMNS view contains a row for each column
|
||
|
of every table and view in the schema.</p>
|
||
|
<div class="section"><p>The following sample statement displays all the column names in
|
||
|
the CORPDATA.DEPARTMENT table: </p>
|
||
|
<pre> <strong>SELECT</strong> *
|
||
|
<strong>FROM</strong> CORPDATA.SYSCOLUMNS
|
||
|
<strong>WHERE</strong> TABLE_NAME = 'DEPARTMENT'</pre>
|
||
|
<p>The result of the
|
||
|
previous sample statement is a row of information for each column in the table.
|
||
|
Some of the information is not visible because the width of the information
|
||
|
is wider than the display screen.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>For more information about each column, specify a select-statement
|
||
|
like this: </p>
|
||
|
<pre> <strong>SELECT</strong> COLUMN_NAME, TABLE_NAME, DATA_TYPE, LENGTH, HAS_DEFAULT
|
||
|
<strong>FROM</strong> CORPDATA.SYSCOLUMNS
|
||
|
<strong>WHERE</strong> TABLE_NAME = 'DEPARTMENT'</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>In addition to the column name for each column, the select-statement
|
||
|
shows: </p>
|
||
|
<ul><li>The name of the table that contains the column</li>
|
||
|
<li>The data type of the column</li>
|
||
|
<li>The length attribute of the column</li>
|
||
|
<li>If the column allows default values</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section"><p>The result looks like this:</p>
|
||
|
</div>
|
||
|
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><thead align="left"><tr><th align="left" valign="bottom" width="24.274406332453825%" id="d0e83">COLUMN_NAME</th>
|
||
|
<th align="left" valign="bottom" width="20.052770448548813%" id="d0e85">TABLE_NAME</th>
|
||
|
<th align="left" valign="bottom" width="16.886543535620053%" id="d0e87">DATA_TYPE</th>
|
||
|
<th align="center" valign="bottom" width="15.03957783641161%" id="d0e89">LENGTH</th>
|
||
|
<th align="center" valign="bottom" width="23.7467018469657%" id="d0e91">HAS_DEFAULT</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td align="left" valign="top" width="24.274406332453825%" headers="d0e83 ">DEPTNO</td>
|
||
|
<td align="left" valign="top" width="20.052770448548813%" headers="d0e85 ">DEPARTMENT</td>
|
||
|
<td align="left" valign="top" width="16.886543535620053%" headers="d0e87 ">CHAR</td>
|
||
|
<td align="center" valign="top" width="15.03957783641161%" headers="d0e89 "> 3</td>
|
||
|
<td align="center" valign="top" width="23.7467018469657%" headers="d0e91 ">N</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="24.274406332453825%" headers="d0e83 ">DEPTNAME</td>
|
||
|
<td align="left" valign="top" width="20.052770448548813%" headers="d0e85 ">DEPARTMENT</td>
|
||
|
<td align="left" valign="top" width="16.886543535620053%" headers="d0e87 ">VARCHAR</td>
|
||
|
<td align="center" valign="top" width="15.03957783641161%" headers="d0e89 ">29</td>
|
||
|
<td align="center" valign="top" width="23.7467018469657%" headers="d0e91 ">N</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="24.274406332453825%" headers="d0e83 ">MGRNO</td>
|
||
|
<td align="left" valign="top" width="20.052770448548813%" headers="d0e85 ">DEPARTMENT</td>
|
||
|
<td align="left" valign="top" width="16.886543535620053%" headers="d0e87 ">CHAR</td>
|
||
|
<td align="center" valign="top" width="15.03957783641161%" headers="d0e89 "> 6</td>
|
||
|
<td align="center" valign="top" width="23.7467018469657%" headers="d0e91 ">Y</td>
|
||
|
</tr>
|
||
|
<tr><td align="left" valign="top" width="24.274406332453825%" headers="d0e83 ">ADMRDEPT</td>
|
||
|
<td align="left" valign="top" width="20.052770448548813%" headers="d0e85 ">DEPARTMENT</td>
|
||
|
<td align="left" valign="top" width="16.886543535620053%" headers="d0e87 ">CHAR</td>
|
||
|
<td align="center" valign="top" width="15.03957783641161%" headers="d0e89 "> 3</td>
|
||
|
<td align="center" valign="top" width="23.7467018469657%" headers="d0e91 ">N</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafydbcat.htm" title="A catalog is automatically created when you create a schema. There is also a system-wide catalog that is always in the QSYS2 library.">Catalogs in database design</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|