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)
 INSERT INTO and stored procs question ...

Author  Topic 

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2004-05-06 : 12:59:54
Here is the deal ...

I have a stored proc in use that returns a single row consisting of bout 10 fields.

I want to use this same sp to populate a temp table in another sp ... but the temp table only needs 2 of the fields (not all 10).

So is there an easy solution to this? Or will I be forced to either duplicate the sp ... or perhaps add another param to tell the sp what fields to return?

gratzi - wg

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-06 : 13:28:46
Why not populate the temp table with all 10 columns - is the resultset that big?
Otherwise either of your suggested solutions will work.

Actually it's only a single row so get it all.
Also consider using output parameters rather than a resultset.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2004-05-06 : 13:30:37
Yah the result is too big
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-06 : 13:42:07
Too big with a single row? Does it have lots of text columns?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2004-05-06 : 13:56:32
two varchar(8000) fields
Go to Top of Page

cas_o
Posting Yak Master

154 Posts

Posted - 2004-05-06 : 16:36:11
Does the SP take parameters ? if so what are they. you might be able to replace it with a view instead.


;-]... Quack Waddle
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-06 : 16:37:47
quote:
Originally posted by wgpubs

two varchar(8000) fields



If ever your row size is over 8060, the INSERT or UPDATE will fail. It would have warned you about this when you created the table. You will need to reduce the size of your columns so that the total row size is under 8060 or use text data type.

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-06 : 22:12:31
Tat's not very big. Certainly bot large nough to go to the effort of creating a new SP to pcater for it unless you have exceptional circumstances.
Try it with all the columns first.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -