WRITETEXT - I'm utterly confused By BOL
From: Frank Thomas (No_at_Spam.org)
Date: 07/17/04
- Next message: David Portas: "Re: T-SQL Update .. from"
- Previous message: AA: "Creating SQL2000 view from a Oracle OpenQuery (Linked server)"
- Next in thread: Dan Guzman: "Re: WRITETEXT - I'm utterly confused By BOL"
- Reply: Dan Guzman: "Re: WRITETEXT - I'm utterly confused By BOL"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 17 Jul 2004 12:39:53 -0700
I just want to avoid the possibility of creating an application that works
most of the time, but periodically chokes because the planets aligned in a
way that resulted in an invalid text pointer.
Specifically, my objective is simply to enable users of an application to
store large strings of text in a SS2K database. By "large" I mean more text
than VarChar allows (will typically range from a few hundred bytes to 1MB).
I don't want to split the data amongst multiple VarChar columns - which
leaves me with Text or NText (AFAIK). Per business logic, any/all updates to
the text will entail a wholesale replacement of any/all text that exists
prior to the update. That is, these updates will not require updating a
subset of the text - the whole thing gets replaced. It will also be possible
for users of the application to remove all text for a given row (i.e., the
column for the row would contain a null value). In my research I found
WRITETEXT. Per BOL, this looks like what I need to accomplish what I want.
Rather than taking the development approach of "let's throw it on the wall
and see if it sticks" - I'm trying to understand what WriteText is all about
so that I implement the business requirements in a way that makes sense,
performs reliably and quickly, blah blah blah. But I'm confused by what BOL
describes...
Can someone explain this quote from BOL/SP3?
<BEGIN QUOTE>
For WRITETEXT to work properly, the column must already contain a valid text
pointer. {okay, I'm with you so far...}
If the table does not have in row text, SQL Server saves space by not
initializing text columns when explicit or implicit null values are placed
in text columns with INSERT, and no text pointer can be obtained for such
nulls. To initialize text columns to NULL, use the UPDATE statement. If the
table has in row text, there is no need to initialize the text column for
nulls and you can always get a text pointer.
<BEGIN QUOTE>
Am I supposed to initialize text columns to NULL or not? I know about null
values - but never heard of explicit null vs implicit null... Theory aside,
I have a system to build and deliver. What should I do given the
requirements as described above - should I create a default value of null
for my Text or NText column? Would that take care of this 'valid pointer'
issue? What value should I store in the column when the user decides to
remove all text content for a given row? If I receive a zero-length string
from the application, should I insert a null into the Text column?
Thanks!
- Next message: David Portas: "Re: T-SQL Update .. from"
- Previous message: AA: "Creating SQL2000 view from a Oracle OpenQuery (Linked server)"
- Next in thread: Dan Guzman: "Re: WRITETEXT - I'm utterly confused By BOL"
- Reply: Dan Guzman: "Re: WRITETEXT - I'm utterly confused By BOL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|