Modifies the database name, table name, table properties, and column information of a table.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | AlterTable |
The operation that you want to perform. Set the value to AlterTable. |
OldDbName | String | Yes | oldDb001 |
The original name of the database. |
OldTableName | String | Yes | oldTbl001 |
The original name of the table. |
NewDbName | String | Yes | newDb001 |
The new name of the database. The new name can be the same as the original name, which indicates that you do not change the name of the database. |
NewTableName | String | Yes | newTbl001 |
The new name of the table. The new name can be the same as the original name, which indicates that you do not change the name of the table. |
Parameters | Map | No |
The properties of the table. |
|
String | No | key001=value001 |
The properties of the table. |
|
Col | Array | Yes |
The column information. |
|
Comment | String | No | this is comment |
The comment of the column. |
Name | String | Yes | new_col1 |
The name of the column. |
Type | String | Yes | int |
The data type of the column. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | NO_SUCH_OBJECT |
The error code returned. |
Data | Boolean | false |
Indicates whether the information of the table is modified. |
Message | String | No such database: bd001 |
The error message returned. |
RequestId | String | 9BEAC206-0795-4DE3-B1FD-964BEF432B23 |
The ID of the request. |
Success | Boolean | true |
Indicates whether the request was successful. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=AlterTable
&OldDbName=oldDb001
&OldTableName=oldTbl001
&NewDbName=newDb001
&NewTableName=newTbl001
&Parameters={"key":"key001=value001"}
&Col=[{"Comment":"this is comment","Name":"new_col1","Type":"int"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<Message>No such database: bd001</Message>
<RequestId>9BEAC206-0795-4DE3-B1FD-964BEF432B23</RequestId>
<Data>false</Data>
<Code>NO_SUCH_OBJECT</Code>
<Success>true</Success>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Message" : "No such database: bd001",
"RequestId" : "9BEAC206-0795-4DE3-B1FD-964BEF432B23",
"Data" : "false",
"Code" : "NO_SUCH_OBJECT",
"Success" : "true"
}
Error codes
For a list of error codes, visit the API Error Center.