Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Manipulating Text Variables


Manipulating Text Variables

Author
Message
Vasant Raj
Vasant Raj
SSC Veteran
SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)

Group: General Forum Members
Points: 203 Visits: 137
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/rVasant/manipulatingtextvariables.asp
Sean McDaniel
Sean McDaniel
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 9

Awesome article! However you mention nothing about speed. Is this method faster than doing an update to a single row? Can you elaborate more on the pros and cons of using this method? Almost sounds too good to be true.

Thanks!


Martin Vrieze
Martin Vrieze
Old Hand
Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)Old Hand (336 reputation)

Group: General Forum Members
Points: 336 Visits: 125

I am using text variable manipulation to construct customized plain text and HTML email messages for hundreds of thousands of customers...no two email messages are the same...each email message has a completely different product mix.

Through the use of a forward-read-only cursors, the entire mail-merge process of 35kilobyte-50kilobyte sized email messages can be completed in well under 3 hours.

Text data manipulation on a SQL Server platform is very, very fast and requires no additional software to be used. I've built other solutions but none have come close to matching the mail-merging speed of performing text data manipulation on the SQL Server box itself.

Text data manipulation is a skill very much worth learning.


David Catherman
David Catherman
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 1

Good article but it does not discuss the real problem with Text fields. I have a problem passing XML data from a Text field in a table to the sp_XML_preparedocument function. There is no way I can find to take the data out of the field and pass it to the function.

The only solution I have found is as the following link:

http://www.awprofessional.com/articles/article.asp?p=102307&seqNum=16&rl=1

where Ken Henderson provides a sample chapter of his book. His method is to dynamically break the long text into 4k chunks and then append them all together when calling the xml function. This is a good idea and has merit as a work around, but I have not gotten it to work yet.

If anyone else has any ideas, please let me know.

DCatherman at cmisolutions dot com


jrh_1999
jrh_1999
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 2

What is the best way to pass text information to a stored procedure? I don't think you can use the "text" type as a sp parameter. Right now I am using a varchar(5000) but that limits the size of the file I can save.

Joel





David Catherman
David Catherman
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 1

Joel,

you can use Text as a parameter type (as noted in the article), but you are limited on how you process the information in the SP.


Dave


Yelena Varshal
Yelena Varshal
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3480 Visits: 593

This article is great!

Text columns is not as rare as you think. I did not work yet with a piece of SW without Text data. ALL CRMs, Tracking Systems, everything that have notes or history to enter have Text data field, everything that have Description have Text data field, now we mentioned XML storage, you name it...

I really appreciate any guidance on working with Text data.




Regards,
Yelena Varshal

John R. Hanson
John R. Hanson
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 120

It is very nice to have a concise overview of text functions and handling. Well done!

There is a serious concideration with regards to triggers, however, since Text columns cannot be included.

an error "Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables." will occur.

If anybody has ideas for Archival functions using Triggers, let me know.

Cheers,

John R. Hanson


SQLior
SQLior
Old Hand
Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)

Group: General Forum Members
Points: 341 Visits: 55
Be aware that in future versions of SS, the TEXT data type will be REMOVED! see BOL topic "Using text and image Data" http://msdn2.microsoft.com/en-us/library/ms189574(SQL.90).aspx

Microsoft has introduced a new data type option called (MAX) to the varchar and binary types. It is an enhanced version of the text types and can do a lot more. If you upgraded to SS2005 then it is very recommended that you start using this option if you use large data. To find out more see the SS BOL topic "Using Large-Value Data Types" http://msdn2.microsoft.com/en-us/library/ms178158.aspx

As an example, consider the previous user's comment re triggers. Now, it is possible to use large data inside triggers using this new data type. There is a lot more info in BOL (search for varchar(max) ).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search