Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Text variables

Author  Topic 

keithlunevich
Starting Member

3 Posts

Posted - 2007-01-17 : 10:17:19
Hello,

I am trying to move some working ASP/SQL code into a SQL Job using SQL 2000. The problem that I am having is with trying to access a text variable. Simply put, what I need to do within SQL is to query a database (one of the fields is a text data type) and then to assign these results to variables which are then used as parameters while calling a stored procedure.

Within SQL you can not declare a text variable (Declare @MyText text;) as it gives this error: "The text, ntext, and image data types are invalid for local variables."

Now I could make this a varchar(8000) variable but this is not large enough to hold all of the information and will be truncated.

Does anybody know of a way to make this work?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-17 : 10:57:44
Why do you think you need that large space for SQL variable?
Avoid dynamic SQL as long as possible!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

keithlunevich
Starting Member

3 Posts

Posted - 2007-01-17 : 11:14:14
Hi Peso,

I am using this for an email sending program in which users subscribe to certain groups and they receive an email when new information is sent out.

I am pulling information from an email queue table which contains information such as to, from, subject, content, etc.

I then pass this information to a stored procedure which sends out the email.

Most of the content of the various emails that get sent out are under 8000 characters but there are a few that are 3 times that size. I need to account for all possibilities and thus need to use the text data type.

Any thoughts?

Thanks,
Go to Top of Page
   

- Advertisement -