vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| "thirdman" <takayasu.harada@csfb.com> wrote in message news:ded5ab9.0401291140.189617db@posting.google.co m... > I'm trying to write a SQL that stores a result from a stored-procedure > into a temporary table. > > Is there any way of doing this? 1) Create table test ( col001 varchar(10) null ) go 2) insert into test select substring(description,1,10) from someothertable |
| |||
| "thirdman" <takayasu.harada@csfb.com> wrote in message news:ded5ab9.0401291140.189617db@posting.google.co m... > I'm trying to write a SQL that stores a result from a stored-procedure > into a temporary table. > > Is there any way of doing this? Create a temp table with the same structure as the result set of the stored procedure, then do this: insert into #table exec dbo.MyProc But there are other options available also - in SQL 2000, a table-valued UDF is often useful. See here for more information: http://www.sommarskog.se/share_data.html Simon |
| ||||
| thirdman (takayasu.harada@csfb.com) writes: > I'm trying to write a SQL that stores a result from a stored-procedure > into a temporary table. > > Is there any way of doing this? Yes, you can say INSERT #tmp (...) EXEC your_sp Beware that you cannot nest this constructs. I don't know what you want to do, but this article mught include information that is useful for you: http://www.sommarskog.se/share_data.html. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |