place the below code in a file which is in root directory and execute the code.
Please take the backup
of your database before running the code.
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect(array('image', 'thumbnail', 'small_image'))
->addAttributeToFilter('thumbnail',array('neq'=>'no_selection'));
foreach($collection as $product){
$path = "Path_of_image_here";
if(is_file($path)){
try {
$product->setSmallImage($path)
//->setThumbnail($path)
//->setImage($path)
->save();
} catch (Exception $e) {
echo $e->getMessage();
}
}
}