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)
 Using READTEXT with INSERT

Author  Topic 

Glockenspiel
Yak Posting Veteran

50 Posts

Posted - 2004-07-12 : 17:54:56
The BOL says it can be done but I haven't been able to get it to work -- can someone who has successfully done this please post a code scrap with the syntax?

Here's what isn't working for me...

INSERT mytemp2 (mycharcolumn) 
READTEXT mytemp.mytext @ptrval @offset @length



Thanks!

From BOL (excerpted from INSERT statement)

execute_statement
Is any valid EXECUTE statement that returns data with SELECT or READTEXT statements.
If execute_statement is used with INSERT, each result set must be compatible with the columns in the table or in column_list. execute_statement can be used to execute stored procedures on the same server or a remote server. The procedure in the remote server is executed, and the result sets are returned to the local server and loaded into the table in the local server. If execute_statement returns data with the READTEXT statement, each individual READTEXT statement can return a maximum of 1 megabyte (MB)
(1024 KB) of data. execute_statement can also be used with extended procedures, and inserts the data returned by the main thread of the extended procedure. Output from threads other than the main thread are not inserted.

Glockenspiel
Yak Posting Veteran

50 Posts

Posted - 2004-07-13 : 11:16:11
Well, according to Occam's Razor, the best solution is the simplest solution, and in this case, the simplest solution was to not use READTEXT at all...

INSERT #mytemp2 (mychar)
SELECT SUBSTRING(mytext,@offset,@length) FROM #mytemp

The above code worked fine for what I was needing to do...
Go to Top of Page
   

- Advertisement -