473,409 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Question Using MSSQL_QUERY

Hi

Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
a while now, but recently noticed a problem. I have a notes field in
the database (varchar 6000) for entering text. When reading out the
data with a simple SELECT statement I noticed it would only get 256
characters in the MSSQL_FETCH_ARRAY result. Don't know how I missed
this before. Obviously a significant number!
I checked the INI file for any settings. The MSSQL.TEXTSIZE and
MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
do with it.

Does anyone know how to get round this problem, I have tried all the
getting methods I know all of which do the same.

Thanks in advance.

Nov 22 '05 #1
3 2132
Gazchurchend wrote:
Hi

Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
a while now, but recently noticed a problem. I have a notes field in
the database (varchar 6000) for entering text. When reading out the
data with a simple SELECT statement I noticed it would only get 256
characters in the MSSQL_FETCH_ARRAY result. Don't know how I missed
this before. Obviously a significant number!
I checked the INI file for any settings. The MSSQL.TEXTSIZE and
MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
do with it.

Does anyone know how to get round this problem, I have tried all the
getting methods I know all of which do the same.

Thanks in advance.


Hi,

Maybe this helps:
[http://expertanswercenter.techtarget...51984,00.html]

DB-Library applications and applications using the SQL Server ODBC drivers
from SQL Server version 6.5 or earlier support only a maximum of 255 bytes
of character data. If these applications attempt to retrieve character
parameters of SQL Server version 7.0 or later, or result set columns
containing more than 255 bytes of data, the character data is truncated at
255 bytes.

----------------------

I once had the same problem under IIS with VBscript. Upgrading the drivers
helped solving it.
Look at M$-site for a MDAC upgrade.

Good luck,
Erwin Moller
Nov 22 '05 #2

Gazchurchend wrote:
Hi

Ive been using PHP to query data from SQL Server using MSSQL_QUERY for
a while now, but recently noticed a problem. I have a notes field in
the database (varchar 6000) for entering text. When reading out the
data with a simple SELECT statement I noticed it would only get 256
characters in the MSSQL_FETCH_ARRAY result. Don't know how I missed
this before. Obviously a significant number!
I checked the INI file for any settings. The MSSQL.TEXTSIZE and
MSSQL.TEXTLIMIT are both set to maximum limits, if this has anything to
do with it.

Does anyone know how to get round this problem, I have tried all the
getting methods I know all of which do the same.


Yeah, it's a real bummer with MSSQL and PHP. What you need to do is
cast the varchar column to text in your query. So instead of

SELECT description FROM tblCrackheads

you need

SELECT CAST(description AS text) FROM tblCrackheads

Nov 22 '05 #3
Cheers the cast works a treat..
I had been using Text type before on large fields hence never noticing
the problem before.
Didn't think to cast it.

Thanks again
Gary

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Walker | last post by:
Hi again As I'm developing my site, i've come across a problem with the database use. While developing it I only have mySQL, but the final server has msSQL. I was thinking about using all my own...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: BethH | last post by:
According to php.net, mssql_query is supposed to return true when no rows are returned. I'm actually getting an empty resource identifier instead of true. The table is empty, there are no rows...
4
by: pks83 | last post by:
In MSSQL I am using datetime as the column type and trying to execute the below mentioned query select time from tickets where ticket_id = '1'; when i execute the query on sql manager window it...
6
by: pugalenthi | last post by:
I am trying to connect to the SQL Server and then to create a database table using PHP script. The code is as follows,<job id="sqlserver1"> <script language="PHPScript"> $connection =...
1
by: printline | last post by:
Hello All I'm quite new to xml vs. PHP, so i hope someone can help with an issue i have been struggeling with. I have an html form, that when submitted, it should create an xml file, and save...
14
by: asivakrupa | last post by:
Hi, I am creating a tool with PHP as front end and SQL Server as back end. I have some values to be inserted into the DB which contains the character ( ' ) i.e single quote. I had errors when...
5
ddtpmyra
by: ddtpmyra | last post by:
I cannot select the distinct records but Im pretty sure im connected to the database. Please tell me what's wrong with this? and why I cannot see the query result? thanks! echo "Status:"; ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.