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 to a procedure

Author  Topic 

iminore
Posting Yak Master

141 Posts

Posted - 2005-02-07 : 07:51:20
I've raised this topic before:

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.

Actually using a temporary table seems to be a no-no. How is the called procedure supposed to get the value from the table given that you cannot have text fields in sub-queries? Breaking a text value into a series of fixed length strings would also seem rather poor.

Any new ideas anyone?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-07 : 08:20:45
It might help to describe what you're trying to do, and why you must use text.

And how about continuing the original thread if you're not substantially changing the topic:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=44977
Go to Top of Page

iminore
Posting Yak Master

141 Posts

Posted - 2005-02-07 : 09:35:31
In one procdure I'm trying to get a text value that exists on a table and pass it to another procedure (which is actually in a different database) to process.

I created a new thread to become 'current' but perhaps there's some other way of doing that.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-07 : 20:37:01
Just reply to the original thread.

In your procedure, why not just have it SELECT the text value from the other database? If they're on the same server, this is very simple and you don't need a temp table either. If they're on different servers, you could still SELECT it using OPENQUERY or whatever method you're using now to retrieve it.

Once you retrieve the text value, what are you doing with it?
Go to Top of Page

iminore
Posting Yak Master

141 Posts

Posted - 2005-02-08 : 04:43:03
The requirement comes down to updating a text column in a table with a text value from another table. Given that text fields cannot appear in sub-queries I'm struggling to get the code for the update.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-08 : 07:26:05
UPDATE A SET textcol=B.textcol
FROM Table1 A
INNER JOIN Table2 B
ON A.ID=B.ID
Go to Top of Page

iminore
Posting Yak Master

141 Posts

Posted - 2005-02-08 : 07:52:22
Take a bow robvolk.

Yes, that works. Many thanks.
Go to Top of Page
   

- Advertisement -