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
 Transact-SQL (2000)
 passing text field to procedure

Author  Topic 

iminore
Posting Yak Master

141 Posts

Posted - 2005-01-21 : 03:52:13
Given that you cannot define text variables in a stored procedure does anyone have a method for passing a text value to another stored procedure other than using a temporary table.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-01-21 : 08:34:23
Not to split hairs, but:

-You CAN pass text VARIABLES to stored procedures. Therefore, you can pass a text VARIABLE from one procedure to the next. You just can't MANIPULATE them as variables.

-You CAN pass text VALUES in variables, BUT you have to pass a LITERAL value, or a non-text VARIABLE.

-You CANNOT get a text value from a table and put it into a text VARIABLE. The best you can do is to split the text value into multiple varchar variables, which you CAN pass concatenated together as if they were a single text VARIABLE:

CREATE PROCEDURE myProc @t text AS
SELECT @t
GO
EXEC myProc @t = @var1 + @var2 + @var3


-There is NOTHING wrong with using temp tables in lieu of parsing, splitting, and recombining VARIABLES. No point in manipulating a lot of data when it is easily accessible to whichever procedure needs it.

Sorry if this sounds pedantic, many people have posted similar questions in the past.
Go to Top of Page

iminore
Posting Yak Master

141 Posts

Posted - 2005-01-21 : 10:17:54
Don't apologise for being pedantic - it's my middle name. Thanks for taking the time.
Go to Top of Page
   

- Advertisement -