dbTalk Databases Forums  

SQL Server 2005 help

comp.databases comp.databases


Discuss SQL Server 2005 help in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rbr
 
Posts: n/a

Default SQL Server 2005 help - 06-27-2006 , 09:03 AM






I am a newly indoctrinated SQL Server 2005 user. So, forgive me if this
question is amatuer.
I am trying to create a stored proc that will read in a list of values
from one table (Possibly using a cte?) then iterate through each record
running another sp to populate a temp table and return all matching
records. The logic would be like the following:

///////
create procedure spSample1

@column2 int

As

create table #tmptbl

(tmptblcol1 int not null)

with samplecte (var1 int)
As
(select column1 from table where column2 = @column2)
begin
while not end-of-file

set localvar1 = current value of samplecte var1

insert into #tmptbl exec spSample2 localvar1
end
////////

This is a very rough outline. Hopefully it helps with clarification of
what I am trying to acheive. Any help would be greatly appreciated.

Thank you in advance!

rbr


Reply With Quote
  #2  
Old   
Bob Lanteigne
 
Posts: n/a

Default Re: SQL Server 2005 help - 06-28-2006 , 02:40 PM






rbr wrote:
Quote:
I am a newly indoctrinated SQL Server 2005 user. So, forgive me if this
question is amatuer.
I am trying to create a stored proc that will read in a list of values
from one table (Possibly using a cte?) then iterate through each record
running another sp to populate a temp table and return all matching
records. The logic would be like the following:
<snip>

Quote:
This is a very rough outline. Hopefully it helps with clarification of
what I am trying to acheive. Any help would be greatly appreciated.
It's not clear to me what your question is, but you might have better
luck getting technical assistance in the
microsoft.public.sqlserver.programming news group.

Bob Lanteigne



Reply With Quote
  #3  
Old   
SRV
 
Posts: n/a

Default Re: SQL Server 2005 help - 06-30-2006 , 06:59 AM




"rbr" <ryankbrown (AT) gmail (DOT) com> wrote

Quote:
I am a newly indoctrinated SQL Server 2005 user. So, forgive me if this
question is amatuer.
I am trying to create a stored proc that will read in a list of values
from one table (Possibly using a cte?) then iterate through each record
running another sp to populate a temp table and return all matching
records. The logic would be like the following:
Your question is not clear, but I think that you must use a cursor and fetch
one by one record from your table.
Try to see in help sintax for cursor. I think this might be usefull for you.
Sorry, I dont have enough time to explain complete solution or to write
code.

Bye.




Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.