$q = $db->query ('SET TEXTSIZE 2147483647');
$q->fetchAll();
ini_set ('mssql.textlimit' , '2147483647');
ini_set ('mssql.textsize' , '2147483647');
$q = $db->query("select CONVERT(TEXT, img) from [shop].[dbo].[news_image] WHERE id = $id");
$res = $q->fetchAll();
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