$datastring = file_get_contents("P1030001.JPG");
$data = unpack("H*hex", $datastring);
mssql_query("insert into images values ('P1030001.JPG', 0x".$data['hex'].")");...