Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How receive larger/texts in MSSQL2k/PHP

Author  Topic 

prabhatkr
Starting Member

6 Posts

Posted - 2008-08-02 : 13:17:01
Hi,

I have a MSSQL 2005 table with two columns(ID & XMLFILE)
ID is data type INT
XMLFILE is data type xml

I am using PHP. I want to retrieve xmlfile partially. But using a stored procedure the max I can retrieve is 255 chars. I don't know any other method.
//////////code////////

ALTER PROCEDURE dbo.getsome
(
@room varchar(80),
@lm int,
@usid int,
@retxml nvarchar(max) OUTPUT
)

AS

SET ANSI_WARNINGS ON
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_PADDING ON


SET @retxml =convert(nvarchar(max),( SELECT
((chat.query('(/sroot[1]/message[@id > sql:variable("@lm")])')))
FROM mdb WHERE url=@room))


RETURN


///////////////////php code below////////////////
global $$link;
$l="";
$stmt=mssql_init("getchat",$$link ); $i=1;
mssql_bind($stmt, "@room", $url, SQLVARCHAR, FALSE);
mssql_bind($stmt, "@usid", $usid, SQLINT4, FALSE);
mssql_bind($stmt, "@lm", $last, SQLINT4, FALSE);
mssql_bind($stmt, "@retxml", $l, SQLVARCHAR, TRUE, FALSE,400);

$result = mssql_execute($stmt);


pk from Asia

dexter.knudson
Constraint Violating Yak Guru

260 Posts

Posted - 2008-08-04 : 03:01:27
You should be able to return the output as a column, just like selecting from a table. Just remove the SET & RETURN & leave only your SELECT statement. You may have to massage your PHP a little.
Go to Top of Page
   

- Advertisement -