forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
71 lines
6.8 KiB
HTML
71 lines
6.8 KiB
HTML
<a name="dli_08_0470"></a><a name="dli_08_0470"></a>
|
|
|
|
<h1 class="topictitle1">Modifying Column Comments</h1>
|
|
<div id="body0000001671161273"><div class="section" id="dli_08_0470__en-us_topic_0156816309_en-us_topic_0093946741_s86887e0a86644c22b61a4c2ccc84025e"><h4 class="sectiontitle">Function</h4><p id="dli_08_0470__en-us_topic_0156816309_en-us_topic_0093946741_a9755a68b9d0d47668ac554151d03e0ce">You can modify the column comments of non-partitioned or partitioned tables.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0470__en-us_topic_0156816309_en-us_topic_0093946741_sd6725bae42f0429e8bc6dfa2e92b9664"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="dli_08_0470__screen265732219573">ALTER TABLE [db_name.]table_name CHANGE COLUMN col_name col_name col_type COMMENT 'col_comment';</pre>
|
|
</div>
|
|
<div class="section" id="dli_08_0470__en-us_topic_0114776199_en-us_topic_0107972084_en-us_topic_0093946811_s85a6f8f752b14c12908d2303d618d510"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0470__ul10263165613711"><li id="dli_08_0470__li11263556173">CHANGE COLUMN: Modify a column.</li><li id="dli_08_0470__li112634564714">COMMENT: column description</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0093946905_s95436b2cebbc4c34b0e6ca8427d4f1d9"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_t2fa8597e0dde4884bd6412ac207ebea8" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_r16c75fd8fdbf41c79f9aee82b032351c"><th align="left" class="cellrowborder" valign="top" width="15.010000000000002%" id="mcps1.3.4.2.2.4.1.1"><p id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_a9dd69379a3f54904a9c510fb817659ad"><strong id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_aaf3d8bb717c048e79cca4e0ae1dd34e7">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="11.06%" id="mcps1.3.4.2.2.4.1.2"><p id="dli_08_0470__p183635351905">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="73.92999999999999%" id="mcps1.3.4.2.2.4.1.3"><p id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_a7ede0d62539542baa7e367cf902bf2b2"><strong id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_a704da68912af434baebe5e3bda073b95">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_r8ab7399810eb42b7abf51ae705c6cf83"><td class="cellrowborder" valign="top" width="15.010000000000002%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_a1cdeda4790a8452d8619c797147bf9cf">db_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0470__p336393514020">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.92999999999999%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0470__en-us_topic_0114776188_en-us_topic_0103084433_p4729195274115">Database name. Only letters, digits, and underscores (_) are allowed. The name cannot contain only digits or start with an underscore (_).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0470__row160712191411"><td class="cellrowborder" valign="top" width="15.010000000000002%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0470__p3608320149">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0470__p12363435408">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.92999999999999%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0470__p160812219141">Table name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0470__row173647290145"><td class="cellrowborder" valign="top" width="15.010000000000002%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0470__p123641229111418">col_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0470__p13639351801">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.92999999999999%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0470__p636492981417">Column name. The value must be the name of an existing column.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0470__row1427615184119"><td class="cellrowborder" valign="top" width="15.010000000000002%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0470__p1842715158414">col_type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0470__p24278152419">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.92999999999999%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0470__p1742751534112">Column data type specified when the table is created, which cannot be modified.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0470__row1213495451419"><td class="cellrowborder" valign="top" width="15.010000000000002%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0470__p202044816817">col_comment</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0470__p1836320351200">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.92999999999999%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0470__p813420545146">Column comment after modification. The comment can contain a maximum of 1024 bytes.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0470__en-us_topic_0156816309_section53871537273"><h4 class="sectiontitle">Example</h4><p id="dli_08_0470__p1897071134">Change the comment of the <strong id="dli_08_0470__b691822718545">c1</strong> column in the <strong id="dli_08_0470__b158291441145412">t1</strong> table to <strong id="dli_08_0470__b4864184718544">the new comment</strong>.</p>
|
|
<div class="codecoloring" codetype="Sql" id="dli_08_0470__en-us_topic_0156816309_screen1166013811137"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">t1</span><span class="w"> </span><span class="n">CHANGE</span><span class="w"> </span><span class="k">COLUMN</span><span class="w"> </span><span class="n">c1</span><span class="w"> </span><span class="n">c1</span><span class="w"> </span><span class="n">STRING</span><span class="w"> </span><span class="k">COMMENT</span><span class="w"> </span><span class="s1">'the new comment'</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0262.html">Modifying a Table</a></div>
|
|
</div>
|
|
</div>
|
|
|