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 2000 Forums
 SQL Server Development (2000)
 Select statements truncated!!!

Author  Topic 

Nato
Starting Member

30 Posts

Posted - 2002-07-25 : 10:30:53
I am running MS SQL 2000 on NT 4. I have just installed the latest MDAC.

However, all my SELECT statements, the ones that outputs Varchar fields. These Varchar fields are 2000 in size. All the Outputs are limited to 255 characters even though there is more then 255 characters in the database.

Can anybody explain why this is happening and how I can fix it.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-25 : 10:36:18
If you're using Query Analyzer, go to Tools/Options and select the Results tab. There is a setting for maximum character width, it defaults to 255 or 256, simply increase it to your choice.

Go to Top of Page

Nato
Starting Member

30 Posts

Posted - 2002-07-25 : 10:51:47
I am not using Query Analyzer. But I made that change anyway. Should I reboot the server before this change will be implemented?

Could it be anything other then Query Analyzer?

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-25 : 10:53:03
If not QA, what are you using to view the data?

No, you don't have to reboot anything.

Go to Top of Page

Nato
Starting Member

30 Posts

Posted - 2002-07-25 : 10:58:53
I have viewed under Query Analyzer and it works fine. But when it is outputted on my PHP page, the data is trincated to 255 characters!


Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-25 : 11:14:12
You'd have to look at your PHP data providers, they may not be able to extract more than 255 characters from a character column. Older ODBC drivers were notorious for this.

<EDIT>

There is a PHP forum at http://dbforums.com/ you might want to try. They might have people who know how to get around this problem.

</EDIT>

Edited by - robvolk on 07/25/2002 11:20:45
Go to Top of Page

Nato
Starting Member

30 Posts

Posted - 2002-07-25 : 11:26:48
Thanks for that. So you think it is a PHP problem rather then a SQL Server problem? What do you mean by "PHP data providers".

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-25 : 11:38:09
The data access interface used by PHP to communicate with the database server (I'm not familiar with PHP so I'm not sure how it does it) I remember reading that PHP had data access functionality built-in.

In ASP however, ADO is usually used to connect to SQL Server. ADO data providers can easily support >255 characters in a column, so ADO wouldn't cause the problem if you were using it. If you're not using ADO, then the method you ARE using is probably the culprit. It could be a simple default setting that needs to be changed to allow more characters, or it could be a hard limit and you'd have to look at another data access method, like ADO.

Go to Top of Page

Nato
Starting Member

30 Posts

Posted - 2002-07-26 : 03:14:41
Thanks for all you help. I think you are right, PHP is designed with MySQL in mind. And becaue in MySQL you can only have a max of 255 characters in Varchar, they assumed that limiting the output of PHP would be okay. Very annoying, hopefully they have solved this problem in the latest version of PHP.

Go to Top of Page
   

- Advertisement -