473,698 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2222
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********@gma il.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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********@gmai l.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********@gma il.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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********@gma il.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.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
10542
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: Msg 403, Level 16, State 1, Line 1
4
10086
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 since DBNull cannot be converted to int. I wrote the following method that looks up the column's data type and if it is a ValueType, returns the default value for the ValueType.
6
3241
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 entry application. The code below gets line items from a SQL Server database and returns them to a datagrid by way of a DataTable called lineTable. As long as I am just displaying columns in the SQL database everything works well. I now want...
5
1745
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 have two parameter : FromNation and ToNation. The select statement as follow : SELECT SID, EmpyCode, EmpyName, LastDayWorked, NationCode, LocCode, DeptCode, Status, RepStatus, ReqRemarks
8
4724
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 with tables looking something like this Forum Name | Topics | Posts | Last Post
5
3401
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 text field. I want to know which Data type I need to use so that it doesnt waste memory. thanks in advance, rAinDeEr
0
1733
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 when you convert the varchar column to text column. Do this through Enterprise Manager Console Create a New table with a column as varchar datatype from Enterprise Manager  table created  Open the table and add one row  Successfully added the...
0
1394
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 solution will not work if the data has larger than 4 KB bytes of data, I think. http://www.thescripts.com/forum/thread80335.html
2
1477
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 select query for RequestDetails column.
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.