Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

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 ASP Free Forums Sponsor:
  #1  
Old August 19th, 2004, 11:10 PM
JeffA JeffA is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 12 JeffA User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 42 sec
Reputation Power: 0
Unhappy Looping info into an SQL function

Hi

I need to get a list of numbers from an sql satement
i.e
SELECT name_ctr FROM actNamePropertyAddressView

then I need to do a loop inserting the name_ctr value
in the procedure below

select dbo.funnucNamePostAddress(name_ctr), 'pr', 0, GETDATE())

then I need to output the results

I would appreciate any feedback on this



Reply With Quote
  #2  
Old August 26th, 2004, 11:34 AM
Hegeso Hegeso is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 Hegeso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You could use a cursor:
--
DECLARE @SomeVar INTEGER
DECLARE myCursor CURSOR FOR
SELECT name_ctr
FROM actNamePropertyAddressView

OPEN myCursor

FETCH NEXT FROM myCursor INTO @SomeVar

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT
dbo.funnucNamePostAddress(@SomeVar, 'pr', 0, GETDATE())
FETCH NEXT FROM myCursor INTO @SomeVar
END

CLOSE myCursor
DEALLOCATE myCursor

Reply With Quote
  #3  
Old August 29th, 2004, 04:50 PM
JeffA JeffA is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 12 JeffA User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 42 sec
Reputation Power: 0
Great

Thanks for that

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Looping info into an SQL function


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 4 hosted by Hostway
Stay green...Green IT