I have a stored procedure on an SQL Server 2005 database that is creating the body of an e-mail. The result of this procedure must be placed in a table that has a TEXT field for the message body for later processing.
The problem I've encountered is that in some scenarios the e-mail to be generated is larger than 8000 characters. So I can't build the message body in TEXT variable since SQL Server doesn't allow variables of type TEXT. I can accumulate the parts of the e-mail into a table variable but doing so deoesn't solve the problem because I cannot append these e-mail parts together into a single variable for inserting into the results table.
Is there a way to (1) manipulate entities larger than 8000 in memory or is there (2) a way for my to accumulatethe values in the field of a (temporary) table into a text field?