combining non related rows (update current row only with a cursor)

M

mcmook

I have a temp table which i'm populating with a cursor thus

OPEN c
FETCH NEXT FROM c INTO
@client_uno,
@matter_uno

--Fetch next record
WHILE @@FETCH_STATUS = 0
BEGIN

-- populate rate table
INSERT INTO #r
(EFF_DATE,RATE,MK_PCNT,GROUP_TYPE,MEMBER_TYPE,ALL_OFFICES,ALL_DEPT,RATE_LEVEL)
exec dbo.sp_cmsratecalc @client_uno,@matter_uno

UPDATE #r SET matter_uno = @matter_uno
UPDATE #r SET client_uno = @client_uno

-- move the cursor
FETCH NEXT FROM c INTO
@client_uno,
@matter_uno
END

the SP (which i dont want to change) returns a row of values based on
two parameters I pass to it.
What I need to to is to INCLUDE these parameters in the result set

The example above doesn't work because it updates the temp table for
all rows, what i need is an "update current row". is this possible?

OR if i could concatenate 2 selects into one that would work also
ie
select 1,2,3
select 4,5,6

to give 1,2,3,4,5,6
 
M

mcmook

I have a temp table which i'm populating with a cursor thus

OPEN c
FETCH NEXT FROM c INTO
@client_uno,
@matter_uno

--Fetch next record
WHILE @@FETCH_STATUS = 0
BEGIN

-- populate rate table
INSERT INTO #r
(EFF_DATE,RATE,MK_PCNT,GROUP_TYPE,MEMBER_TYPE,ALL_OFFICES,ALL_DEPT,RATE_LEV­EL)
exec dbo.sp_cmsratecalc @client_uno,@matter_uno

UPDATE #r SET matter_uno = @matter_uno
UPDATE #r SET client_uno = @client_uno

-- move the cursor
FETCH NEXT FROM c INTO
@client_uno,
@matter_uno
END

the SP (which i dont want to change) returns a row of values based on
two parameters I pass to it.
What I need to to is to INCLUDE these parameters in the result set

The example above doesn't work because it updates the temp table for
all rows, what i need is an "update current row". is this possible?

OR if i could concatenate 2 selects into one that would work also
ie
select 1,2,3
select 4,5,6

to give 1,2,3,4,5,6

apologies this should have been posted in a SQL server group.
 
Top