public renameColumn ( string $table, string $oldName, string $newName ) : string | ||
$table | string | the table whose column is to be renamed. The name will be properly quoted by the method. |
$oldName | string | the old name of the column. The name will be properly quoted by the method. |
$newName | string | the new name of the column. The name will be properly quoted by the method. |
return | string | the SQL statement for renaming a DB column. |
public function renameColumn($table, $oldName, $newName)
{
$table = $this->db->quoteTableName($table);
$oldName = $this->db->quoteColumnName($oldName);
$newName = $this->db->quoteColumnName($newName);
return "sp_rename '{$table}.{$oldName}', {$newName}, 'COLUMN'";
}