mssql_connect($mssql_host, $mssql_user, $mssql_pass) or die('Error connecting to database');
mssql_query("SET TEXTSIZE 2147483647");
$att=mssql_query("SELECT TheName, MimeType, TheSize, Content
FROM [$mssql_base2].[dbo].[Document] WHERE ID='$attachmentID'");
if ($row_att = mssql_fetch_array($att, MSSQL_ASSOC) ) {
$TheName=$row_att['TheName'];
$MimeType=$row_att['MimeType'];
$TheSize=$row_att['TheSize'];
$Content=$row_att['Content'];
print $Content;
}#end if