MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old June 23rd, 2004, 06:02 AM
digjen digjen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 57 digjen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 19 sec
Reputation Power: 9
Help with stored procedure

Hi...

I'm looping a table inside a stored procedure.
For every row I do alot's of stuff with the data and put some results in a variable.

Like this:
While
@result = x + y - z
@idfield = @userid
End

I want the result of the stored procedure to be a recordset with my new data.
Without creating a temporary table, insert the data, select the table and then deleting the table.

How do I do that?

Reply With Quote
  #2  
Old June 23rd, 2004, 07:44 AM
lucasalexander lucasalexander is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Atlanta
Posts: 39 lucasalexander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to lucasalexander Send a message via MSN to lucasalexander
What version of SQL Server are you using? If it's SQL 2000, you could use a table variable instead of a temp table.

Lucas Alexander
http://www.alexanderdevelopment.net

Reply With Quote
  #3  
Old June 23rd, 2004, 08:27 AM
digjen digjen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 57 digjen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 19 sec
Reputation Power: 9
Thanx

I'm using SQL Server 2000
I'll try the table variable.
Is there another way to solve the problem?

Thanks

Reply With Quote
  #4  
Old June 23rd, 2004, 08:50 AM
digjen digjen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 57 digjen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 19 sec
Reputation Power: 9
Thanks again

The table variable saved my day.

Thanks alot

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Help with stored procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway