PHP4, mssql_* and SQL Server 2005
PHP4, mssql_* and SQL Server 2005
am 04.11.2008 20:01:07 von Weaver Hickerson
--_000_ABCB7A897A660F4A82DD477F0EA38090DA9CE42F9CEXVMBX0034e xc_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Greetings to the group. We have a PHP4 application that we moved to SQL se=
rver 2005 from SQL server 2000. Everything seems to work fine except for s=
o far we have found 2 queries that "break". Pointing back to the SQL Serve=
r 2000 server, they work fine again.
Closing the gate once the horse is out, I then began googling and it appear=
s that there is some controversy over whether PHP4 works with SQL 2005? S=
o far everything but this works so I'm wondering if there are some php INI =
settings and/or SQL Server settings that might make the 2 get along better.=
..
Any help appreciated in resolving this without having to do an overnight fo=
rklift port to PHP5 (would that it be that easy..)
--------------------------------
Weaver Hickerson, President
LightSpeed Technology Group
wdhicker@lightspeedinc.com
770-787-0880 ext 3011
--_000_ABCB7A897A660F4A82DD477F0EA38090DA9CE42F9CEXVMBX0034e xc_--
Re: PHP4, mssql_* and SQL Server 2005
am 04.11.2008 22:47:20 von dmagick
Weaver Hickerson wrote:
> Greetings to the group. We have a PHP4 application that we moved to SQL server 2005 from SQL server 2000. Everything seems to work fine except for so far we have found 2 queries that "break". Pointing back to the SQL Server 2000 server, they work fine again.
If it's only 2 queries I suspect that sql server 2005 breaks for those
queries (whether they added new reserved words or whatever).
If you run those 2 queries manually through the db, what happens?
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP4, mssql_* and SQL Server 2005
am 05.11.2008 01:03:48 von dmagick
Please always cc the mailing list so others can offer extra
advice/suggestions etc.
Weaver Hickerson wrote:
> they work in query analyzer.
ok so the queries aren't the problem.
do you get an error? what is it?
Might need to play with these settings:
http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
> And they seem to work on a new server I setup for testing that has
> ZendCore and on which I installed the Microsoft PHP driver and ported
> the code to that driver. :(
That does seem to point to the driver, not sure what other suggestions I
can offer.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP4, mssql_* and SQL Server 2005
am 05.11.2008 01:04:33 von dmagick
Chris wrote:
> Please always cc the mailing list so others can offer extra
> advice/suggestions etc.
>
> Weaver Hickerson wrote:
>> they work in query analyzer.
>
> ok so the queries aren't the problem.
>
> do you get an error? what is it?
>
> Might need to play with these settings:
>
> http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
> http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
and possibly this one:
http://www.php.net/manual/en/function.mssql-get-last-message .php
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP4, mssql_* and SQL Server 2005
am 05.11.2008 09:31:48 von krister.karlstrom
Hi!
Have you checked that the query is escaped correctly? All single quotes
(') needs to be escaped with another single quote, but that has been for
MS-SQL all the time so I'll doubt that the problem is escaping.
Another issue I noticed is that SQL Server 2005 handles SMALLDATETIME
coulmns slightly different, and the default formatting of the retuned
date is in some collations different than in SQL Server 2000. So if you
have any queries relying on a where clause that checks a SMALLDATETIME
column you might need to adjust the date format.
Migrating to SQL 2005 might also cause some problems with character
encoding, since SQL 2005 internally works with Unicode. At least for us
who needs other characters than 7-bit ASCII... I had big trouble with
moving ISO-8859-15 XML documents to a SQL Server 2005 Unicode server and
parsing them into a native XML datatype (which is a really nice
feature!), but the problems can be overcomed with a litte extra work...
You could also check that you use the correct protocol version of
FreeTDS, if you're running PHP under Linux. I don't know how PHP
connects to MS-SQL on Windows though.
Currently I have no other thoughts of what could cause your problems, at
least without not being able to actually see the failed queries.
Regards,
Krister Karlström, Helsinki, Finland
Chris wrote:
> Please always cc the mailing list so others can offer extra
> advice/suggestions etc.
>
> Weaver Hickerson wrote:
>> they work in query analyzer.
>
> ok so the queries aren't the problem.
>
> do you get an error? what is it?
>
> Might need to play with these settings:
>
> http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
> http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
>
>> And they seem to work on a new server I setup for testing that has
>> ZendCore and on which I installed the Microsoft PHP driver and ported
>> the code to that driver. :(
>
> That does seem to point to the driver, not sure what other suggestions I
> can offer.
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP4, mssql_* and SQL Server 2005
am 05.11.2008 14:55:38 von Weaver Hickerson
Krister -
I've included the query below - If I paste it in query analyzer on 2000, or=
2005 it works fine.
Just coming through PHP4 to 2005, it hangs. I actually don't get an error,=
and then the browser says the server is too busy to handle the request. S=
trange things like that. (I am using Zend Core with Apache and PHP 5). I w=
ill check for smalldatetime fields.
SELECT COUNT(DISTINCT C.CHART_ID) AS TOTAL,
SUM(ISNULL(FEE_SCHEDULE.FEE,0) * UNITS) AS TOTALFEE
FROM HL7 H,
CHART C
LEFT OUTER JOIN CHART_CODE D
LEFT OUTER JOIN CHART_CODE_MODIFIER CCM
ON CCM.CHART_CODE_ID =3D D.CHART_CODE_ID
AND CCM.CHART_CODE_MODIFIER_ID =3D (SELECT MI=
N(CHART_CODE_MODIFIER_ID)
FROM CHAR=
T_CODE_MODIFIER
WHERE CHAR=
T_CODE_ID =3D D.CHART_CODE_ID)
LEFT OUTER JOIN FEE_SCHEDULE
ON FEE_SCHEDULE.CPT_CODE =3D D.CHART_CODE
AND FEE_SCHEDULE.START_DATE <=3D (SELECT MSH_=
DTM
FROM HL7,
CHART,
CHART_=
CODE
WHERE CHART_=
CODE.CHART_ID =3D CHART.CHART_ID
AND CH=
ART.HL7_ID =3D HL7.HL7_ID
AND CH=
ART_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
AND FEE_SCHEDULE.END_DATE >=3D (SELECT MSH_DT=
M
FROM HL7,
CHART,
CHART_CO=
DE
WHERE CHART_CO=
DE.CHART_ID =3D CHART.CHART_ID
AND CHAR=
T.HL7_ID =3D HL7.HL7_ID
AND CHAR=
T_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
AND FEE_SCHEDULE.SENDING_FACILITY =3D (SELECT=
SENDING_FACILITY
FROM H=
L7,
C=
HART,
C=
HART_CODE
WHERE C=
HART_CODE.CHART_ID =3D CHART.CHART_ID
A=
ND CHART.HL7_ID =3D HL7.HL7_ID
A=
ND CHART_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
AND FEE_SCHEDULE.CODE_TYPE =3D 'pro'
AND FEE_SCHEDULE.MODIFIER =3D CCM.MODIFIER
LEFT OUTER JOIN FEE_SCHEDULE FS
ON FS.CPT_CODE =3D D.CHART_CODE
AND FS.START_DATE <=3D (SELECT MSH_DTM
FROM HL7,
CHART,
CHART_CODE
WHERE CHART_CODE.CHART=
_ID =3D CHART.CHART_ID
AND CHART.HL7_ID=
=3D HL7.HL7_ID
AND CHART_CODE.C=
HART_CODE_ID =3D D.CHART_CODE_ID)
AND FS.END_DATE >=3D (SELECT MSH_DTM
FROM HL7,
CHART,
CHART_CODE
WHERE CHART_CODE.CHART_I=
D =3D CHART.CHART_ID
AND CHART.HL7_ID =
=3D HL7.HL7_ID
AND CHART_CODE.CHA=
RT_CODE_ID =3D D.CHART_CODE_ID)
AND FS.SENDING_FACILITY =3D (SELECT SENDING_F=
ACILITY
FROM HL7,
CHART,
CHART_CODE
WHERE CHART_CODE.=
CHART_ID =3D CHART.CHART_ID
AND CHART.H=
L7_ID =3D HL7.HL7_ID
AND CHART_C=
ODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
AND FS.CODE_TYPE =3D 'pro'
AND (FS.MODIFIER =3D ''
OR FS.MODIFIER IS NULL)
ON D.CHART_CODE_ID IN (SELECT MIN(CHART_CODE_ID)
FROM CHART_CODE
WHERE CHART_ID =3D C.CHART_ID)
WHERE MSH_DTM >=3D '10/01/2008'
AND MSH_DTM < DATEADD(D,1,'10/31/2008')
AND H.HL7_ID =3D C.HL7_ID
AND CHART_CODE IN ('99281','99282','99283','99284',
'99285','99291')
AND C.STATUS =3D 6
AND H.SENDING_FACILITY =3D 'AEU'
ORDER BY 1
________________________________________
From: Krister Karlström [krister.karlstrom@arcada.fi]
Sent: Wednesday, November 05, 2008 3:31 AM
To: Weaver Hickerson
Cc: PHP DB
Subject: Re: [PHP-DB] PHP4, mssql_* and SQL Server 2005
Hi!
Have you checked that the query is escaped correctly? All single quotes
(') needs to be escaped with another single quote, but that has been for
MS-SQL all the time so I'll doubt that the problem is escaping.
Another issue I noticed is that SQL Server 2005 handles SMALLDATETIME
coulmns slightly different, and the default formatting of the retuned
date is in some collations different than in SQL Server 2000. So if you
have any queries relying on a where clause that checks a SMALLDATETIME
column you might need to adjust the date format.
Migrating to SQL 2005 might also cause some problems with character
encoding, since SQL 2005 internally works with Unicode. At least for us
who needs other characters than 7-bit ASCII... I had big trouble with
moving ISO-8859-15 XML documents to a SQL Server 2005 Unicode server and
parsing them into a native XML datatype (which is a really nice
feature!), but the problems can be overcomed with a litte extra work...
You could also check that you use the correct protocol version of
FreeTDS, if you're running PHP under Linux. I don't know how PHP
connects to MS-SQL on Windows though.
Currently I have no other thoughts of what could cause your problems, at
least without not being able to actually see the failed queries.
Regards,
Krister Karlström, Helsinki, Finland
Chris wrote:
> Please always cc the mailing list so others can offer extra
> advice/suggestions etc.
>
> Weaver Hickerson wrote:
>> they work in query analyzer.
>
> ok so the queries aren't the problem.
>
> do you get an error? what is it?
>
> Might need to play with these settings:
>
> http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
> http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
>
>> And they seem to work on a new server I setup for testing that has
>> ZendCore and on which I installed the Microsoft PHP driver and ported
>> the code to that driver. :(
>
> That does seem to point to the driver, not sure what other suggestions I
> can offer.
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP4, mssql_* and SQL Server 2005
am 05.11.2008 20:03:41 von krister.karlstrom
Ouch! That was like the.. longest.. query that I've ever seen! I'm
surprised that it actually works and even more impressed that someone
actually figured that out... It might take a long time to run, since it
uses so many subqueries (if there's lots of data or even a moderate
amount of data). Are you sure there's no easier way to fetch your data?
Most subqueries can be re-written using a join and some more
where-comparisons instead...
Actually I'm more amazed that you actually can send that query and that
it works.. There's a slight chance that your problems might be solved by
rewriting that query... Maybe it's just to long or something, I don't
know. I will however not take the time to refactor that query... :)
Are you running PHP under Linux or Windows? You said that you only found
two queries that breaks? Wll, if the shorter ones works, but the longer
ones hangs, then maybe that's the problem...? :)
Regards,
Krister Karlström, Helsinki, Finland
Weaver Hickerson wrote:
> Krister -
> I've included the query below - If I paste it in query analyzer on 2000, or 2005 it works fine.
>
> Just coming through PHP4 to 2005, it hangs. I actually don't get an error, and then the browser says the server is too busy to handle the request. Strange things like that. (I am using Zend Core with Apache and PHP 5). I will check for smalldatetime fields.
>
>
> SELECT COUNT(DISTINCT C.CHART_ID) AS TOTAL,
> SUM(ISNULL(FEE_SCHEDULE.FEE,0) * UNITS) AS TOTALFEE
> FROM HL7 H,
> CHART C
> LEFT OUTER JOIN CHART_CODE D
> LEFT OUTER JOIN CHART_CODE_MODIFIER CCM
> ON CCM.CHART_CODE_ID = D.CHART_CODE_ID
> AND CCM.CHART_CODE_MODIFIER_ID = (SELECT MIN(CHART_CODE_MODIFIER_ID)
> FROM CHART_CODE_MODIFIER
> WHERE CHART_CODE_ID = D.CHART_CODE_ID)
> LEFT OUTER JOIN FEE_SCHEDULE
> ON FEE_SCHEDULE.CPT_CODE = D.CHART_CODE
> AND FEE_SCHEDULE.START_DATE <= (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FEE_SCHEDULE.END_DATE >= (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FEE_SCHEDULE.SENDING_FACILITY = (SELECT SENDING_FACILITY
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FEE_SCHEDULE.CODE_TYPE = 'pro'
> AND FEE_SCHEDULE.MODIFIER = CCM.MODIFIER
> LEFT OUTER JOIN FEE_SCHEDULE FS
> ON FS.CPT_CODE = D.CHART_CODE
> AND FS.START_DATE <= (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FS.END_DATE >= (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FS.SENDING_FACILITY = (SELECT SENDING_FACILITY
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART_ID = CHART.CHART_ID
> AND CHART.HL7_ID = HL7.HL7_ID
> AND CHART_CODE.CHART_CODE_ID = D.CHART_CODE_ID)
> AND FS.CODE_TYPE = 'pro'
> AND (FS.MODIFIER = ''
> OR FS.MODIFIER IS NULL)
> ON D.CHART_CODE_ID IN (SELECT MIN(CHART_CODE_ID)
> FROM CHART_CODE
> WHERE CHART_ID = C.CHART_ID)
> WHERE MSH_DTM >= '10/01/2008'
> AND MSH_DTM < DATEADD(D,1,'10/31/2008')
> AND H.HL7_ID = C.HL7_ID
> AND CHART_CODE IN ('99281','99282','99283','99284',
> '99285','99291')
> AND C.STATUS = 6
> AND H.SENDING_FACILITY = 'AEU'
> ORDER BY 1
>
>
> ________________________________________
> From: Krister Karlström [krister.karlstrom@arcada.fi]
> Sent: Wednesday, November 05, 2008 3:31 AM
> To: Weaver Hickerson
> Cc: PHP DB
> Subject: Re: [PHP-DB] PHP4, mssql_* and SQL Server 2005
>
> Hi!
>
> Have you checked that the query is escaped correctly? All single quotes
> (') needs to be escaped with another single quote, but that has been for
> MS-SQL all the time so I'll doubt that the problem is escaping.
>
> Another issue I noticed is that SQL Server 2005 handles SMALLDATETIME
> coulmns slightly different, and the default formatting of the retuned
> date is in some collations different than in SQL Server 2000. So if you
> have any queries relying on a where clause that checks a SMALLDATETIME
> column you might need to adjust the date format.
>
> Migrating to SQL 2005 might also cause some problems with character
> encoding, since SQL 2005 internally works with Unicode. At least for us
> who needs other characters than 7-bit ASCII... I had big trouble with
> moving ISO-8859-15 XML documents to a SQL Server 2005 Unicode server and
> parsing them into a native XML datatype (which is a really nice
> feature!), but the problems can be overcomed with a litte extra work...
>
> You could also check that you use the correct protocol version of
> FreeTDS, if you're running PHP under Linux. I don't know how PHP
> connects to MS-SQL on Windows though.
>
> Currently I have no other thoughts of what could cause your problems, at
> least without not being able to actually see the failed queries.
>
> Regards,
> Krister Karlström, Helsinki, Finland
>
> Chris wrote:
>
>> Please always cc the mailing list so others can offer extra
>> advice/suggestions etc.
>>
>> Weaver Hickerson wrote:
>>> they work in query analyzer.
>> ok so the queries aren't the problem.
>>
>> do you get an error? what is it?
>>
>> Might need to play with these settings:
>>
>> http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
>> http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
>>
>>> And they seem to work on a new server I setup for testing that has
>>> ZendCore and on which I installed the Microsoft PHP driver and ported
>>> the code to that driver. :(
>> That does seem to point to the driver, not sure what other suggestions I
>> can offer.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP4, mssql_* and SQL Server 2005
am 17.11.2008 23:09:25 von Weaver Hickerson
Follow up-
We solved this by moving that hugemongous query into a stored procedure. N=
ot the most elegant fix but until we get to PHP5 and native driver, etc it =
seems our only fix.
-----Original Message-----
From: Krister Karlström [mailto:krister.karlstrom@arcada.fi]
Sent: Wednesday, November 05, 2008 2:04 PM
To: Weaver Hickerson
Cc: PHP DB
Subject: Re: [PHP-DB] PHP4, mssql_* and SQL Server 2005
Ouch! That was like the.. longest.. query that I've ever seen! I'm
surprised that it actually works and even more impressed that someone
actually figured that out... It might take a long time to run, since it
uses so many subqueries (if there's lots of data or even a moderate
amount of data). Are you sure there's no easier way to fetch your data?
Most subqueries can be re-written using a join and some more
where-comparisons instead...
Actually I'm more amazed that you actually can send that query and that
it works.. There's a slight chance that your problems might be solved by
rewriting that query... Maybe it's just to long or something, I don't
know. I will however not take the time to refactor that query... :)
Are you running PHP under Linux or Windows? You said that you only found
two queries that breaks? Wll, if the shorter ones works, but the longer
ones hangs, then maybe that's the problem...? :)
Regards,
Krister Karlström, Helsinki, Finland
Weaver Hickerson wrote:
> Krister -
> I've included the query below - If I paste it in query analyzer on 2000, =
or 2005 it works fine.
>
> Just coming through PHP4 to 2005, it hangs. I actually don't get an erro=
r, and then the browser says the server is too busy to handle the request. =
Strange things like that. (I am using Zend Core with Apache and PHP 5). I=
will check for smalldatetime fields.
>
>
> SELECT COUNT(DISTINCT C.CHART_ID) AS TOTAL,
> SUM(ISNULL(FEE_SCHEDULE.FEE,0) * UNITS) AS TOTALFEE
> FROM HL7 H,
> CHART C
> LEFT OUTER JOIN CHART_CODE D
> LEFT OUTER JOIN CHART_CODE_MODIFIER CCM
> ON CCM.CHART_CODE_ID =3D D.CHART_CODE_ID
> AND CCM.CHART_CODE_MODIFIER_ID =3D (SELECT =
MIN(CHART_CODE_MODIFIER_ID)
> FROM CH=
ART_CODE_MODIFIER
> WHERE CH=
ART_CODE_ID =3D D.CHART_CODE_ID)
> LEFT OUTER JOIN FEE_SCHEDULE
> ON FEE_SCHEDULE.CPT_CODE =3D D.CHART_CODE
> AND FEE_SCHEDULE.START_DATE <=3D (SELECT MS=
H_DTM
> FROM HL7,
> CHAR=
T,
> CHAR=
T_CODE
> WHERE CHAR=
T_CODE.CHART_ID =3D CHART.CHART_ID
> AND =
CHART.HL7_ID =3D HL7.HL7_ID
> AND =
CHART_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
> AND FEE_SCHEDULE.END_DATE >=3D (SELECT MSH_=
DTM
> FROM HL7,
> CHART,
> CHART_=
CODE
> WHERE CHART_=
CODE.CHART_ID =3D CHART.CHART_ID
> AND CH=
ART.HL7_ID =3D HL7.HL7_ID
> AND CH=
ART_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
> AND FEE_SCHEDULE.SENDING_FACILITY =3D (SELE=
CT SENDING_FACILITY
> FROM =
HL7,
> =
CHART,
> =
CHART_CODE
> WHERE =
CHART_CODE.CHART_ID =3D CHART.CHART_ID
> =
AND CHART.HL7_ID =3D HL7.HL7_ID
> =
AND CHART_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
> AND FEE_SCHEDULE.CODE_TYPE =3D 'pro'
> AND FEE_SCHEDULE.MODIFIER =3D CCM.MODIFIER
> LEFT OUTER JOIN FEE_SCHEDULE FS
> ON FS.CPT_CODE =3D D.CHART_CODE
> AND FS.START_DATE <=3D (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHA=
RT_ID =3D CHART.CHART_ID
> AND CHART.HL7_=
ID =3D HL7.HL7_ID
> AND CHART_CODE=
..CHART_CODE_ID =3D D.CHART_CODE_ID)
> AND FS.END_DATE >=3D (SELECT MSH_DTM
> FROM HL7,
> CHART,
> CHART_CODE
> WHERE CHART_CODE.CHART=
_ID =3D CHART.CHART_ID
> AND CHART.HL7_ID=
=3D HL7.HL7_ID
> AND CHART_CODE.C=
HART_CODE_ID =3D D.CHART_CODE_ID)
> AND FS.SENDING_FACILITY =3D (SELECT SENDING=
_FACILITY
> FROM HL7,
> CHART,
> CHART_COD=
E
> WHERE CHART_COD=
E.CHART_ID =3D CHART.CHART_ID
> AND CHART=
..HL7_ID =3D HL7.HL7_ID
> AND CHART=
_CODE.CHART_CODE_ID =3D D.CHART_CODE_ID)
> AND FS.CODE_TYPE =3D 'pro'
> AND (FS.MODIFIER =3D ''
> OR FS.MODIFIER IS NULL)
> ON D.CHART_CODE_ID IN (SELECT MIN(CHART_CODE_ID)
> FROM CHART_CODE
> WHERE CHART_ID =3D C.CHART_ID)
> WHERE MSH_DTM >=3D '10/01/2008'
> AND MSH_DTM < DATEADD(D,1,'10/31/2008')
> AND H.HL7_ID =3D C.HL7_ID
> AND CHART_CODE IN ('99281','99282','99283','99284',
> '99285','99291')
> AND C.STATUS =3D 6
> AND H.SENDING_FACILITY =3D 'AEU'
> ORDER BY 1
>
>
> ________________________________________
> From: Krister Karlström [krister.karlstrom@arcada.fi]
> Sent: Wednesday, November 05, 2008 3:31 AM
> To: Weaver Hickerson
> Cc: PHP DB
> Subject: Re: [PHP-DB] PHP4, mssql_* and SQL Server 2005
>
> Hi!
>
> Have you checked that the query is escaped correctly? All single quotes
> (') needs to be escaped with another single quote, but that has been for
> MS-SQL all the time so I'll doubt that the problem is escaping.
>
> Another issue I noticed is that SQL Server 2005 handles SMALLDATETIME
> coulmns slightly different, and the default formatting of the retuned
> date is in some collations different than in SQL Server 2000. So if you
> have any queries relying on a where clause that checks a SMALLDATETIME
> column you might need to adjust the date format.
>
> Migrating to SQL 2005 might also cause some problems with character
> encoding, since SQL 2005 internally works with Unicode. At least for us
> who needs other characters than 7-bit ASCII... I had big trouble with
> moving ISO-8859-15 XML documents to a SQL Server 2005 Unicode server and
> parsing them into a native XML datatype (which is a really nice
> feature!), but the problems can be overcomed with a litte extra work...
>
> You could also check that you use the correct protocol version of
> FreeTDS, if you're running PHP under Linux. I don't know how PHP
> connects to MS-SQL on Windows though.
>
> Currently I have no other thoughts of what could cause your problems, at
> least without not being able to actually see the failed queries.
>
> Regards,
> Krister Karlström, Helsinki, Finland
>
> Chris wrote:
>
>> Please always cc the mailing list so others can offer extra
>> advice/suggestions etc.
>>
>> Weaver Hickerson wrote:
>>> they work in query analyzer.
>> ok so the queries aren't the problem.
>>
>> do you get an error? what is it?
>>
>> Might need to play with these settings:
>>
>> http://www.php.net/manual/en/function.mssql-min-error-severi ty.php
>> http://www.php.net/manual/en/function.mssql-min-message-seve rity.php
>>
>>> And they seem to work on a new server I setup for testing that has
>>> ZendCore and on which I installed the Microsoft PHP driver and ported
>>> the code to that driver. :(
>> That does seem to point to the driver, not sure what other suggestions I
>> can offer.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php