473,395 Members | 2,436 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,395 software developers and data experts.

How do I use SELECT on a column with datatype TEXT?

Hello. I using a simply SELECT statement to retrieve some data from a
SQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXT
because the amount of data. Anyway, my SQL statements worked just fine
when I was using VARCHAR, but now since I am using TEXT, I am only
receiving part of the content back. Do I have to do some sort of
special Casting or something if I want to get all the content back?
It's over 8,000 characters. Thank you very much. I have racking my
brain on this for a while.

Dec 20 '05 #1
8 2205
The number of bytes returned is controlled by the SET TEXTSIZE connection
setting. According the Books Online, the default is 4096 and ODBC sets it
to 2147483647 when connecting. Additionally, Query Analyzer limits the
column size according to the Tools-->Options-->Results setting.

In any case, a Profile trace should reveal the SET TEXTSIZE setting.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<ge********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hello. I using a simply SELECT statement to retrieve some data from a
SQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXT
because the amount of data. Anyway, my SQL statements worked just fine
when I was using VARCHAR, but now since I am using TEXT, I am only
receiving part of the content back. Do I have to do some sort of
special Casting or something if I want to get all the content back?
It's over 8,000 characters. Thank you very much. I have racking my
brain on this for a while.

Dec 20 '05 #2
ge********@gmail.com wrote:
Hello. I using a simply SELECT statement to retrieve some data from a
SQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXT
because the amount of data. Anyway, my SQL statements worked just fine
when I was using VARCHAR, but now since I am using TEXT, I am only
receiving part of the content back. Do I have to do some sort of
special Casting or something if I want to get all the content back?
It's over 8,000 characters. Thank you very much. I have racking my
brain on this for a while.


Let me guess: you're testing this in QA and noticing that the TEXT data is
truncated ...?
If so, go into the Options dialog and uncheck the option to truncate TEXT
results.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 20 '05 #3
adi
When you say 'receiving part of the content' is this in your
application or on SQL Query Analyzer?
If is the later then change the settings under: Options-results, but if
it is an app then may be you should try reading it into a variable that
can read a Text type from SQL.

just my 2 cents.

Dec 20 '05 #4
Thanks for the reply. When I say "receiving part of the content" I am
talking about in my application. I am using PHP to connect via ODBC
(Easysoft Driver) to the SQL Server machines. I am reading the content
back into a variable, and then displaying the variable. But the content
is truncated. Do I have to do something special since I am reading in a
text datatype? It reads in everything else just fine, and acted fine
when this colum was a varchar datatype.

Dec 20 '05 #5
I don't know about your Easysoft Driver but the Microsoft SQL Server ODBC
driver sets the textsize value at 2GB. If the Easysoft Driver doesn't set
the textsize, it will default to 4096.

You ought to be able to issue an explicit 'SET TEXTSIZE 2147483647' in your
application to prevent truncation.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<ge********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Thanks for the reply. When I say "receiving part of the content" I am
talking about in my application. I am using PHP to connect via ODBC
(Easysoft Driver) to the SQL Server machines. I am reading the content
back into a variable, and then displaying the variable. But the content
is truncated. Do I have to do something special since I am reading in a
text datatype? It reads in everything else just fine, and acted fine
when this colum was a varchar datatype.

Dec 20 '05 #6
That does help. Question. How does the "SET TEXTSIZE" usually go? Is it
part of the SELECT statement? Thanks again for your help.

Dec 21 '05 #7
Ok I found where to place the SET TEXTSIZE statement, but still
nothing. Everything is still truncated. Any other ideas?

Dec 22 '05 #8
SET TEXTSIZE must be executed on the same connection as the subsequent
SELECT. You can run a Profiler trace to verify that is indeed what is
happening. Perhaps your driver is doing something screwy behind your back.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<ge********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Ok I found where to place the SET TEXTSIZE statement, but still
nothing. Everything is still truncated. Any other ideas?

Dec 22 '05 #9

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

Similar topics

3
by: Loi Tan Vo | last post by:
Hi, I have boolean values in a table for ex. Federation. And I want to select following Select 'Insert into' + member + 'test' as test1from federation Then I get error message Server:...
4
by: Brian Brane | last post by:
I have properties that wrap DataRow columns as in: public int aNumber { get{ return m_DataRow; } set{ m_DataRow = value; } } If the column happens to contain DBNull, I get a cast exception...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
5
by: Han Lim | last post by:
Dear All, I have an application written by VB.Net with connect to a Microsoft Access database. One of the forms is to select data using oleAdapter and fill it into a dataset. In the oleAdapter, i...
8
by: Thomas | last post by:
Hi! I´m a newbie with this and I´m trying to build a forum of my own but have stumbled on my first problem as early as the opening page. To the problem: I want to show a simple forum layout...
5
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character...
0
Krishna Ladwa
by: Krishna Ladwa | last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
0
by: haukenpo | last post by:
Does anyone has solution for having a similar replace() function on datatype text column? I wish to replace a string with another string in a datatype TEXT column on MSSQL2000. The following...
2
by: sdbabultarkar | last post by:
Hi I am using below query to retrive the data SELECT RequestDetails FROM Request Where as RequestDetails is Column with Text datatype. I am getting truncated records for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.