Groups | Blog | Home
all groups > sql server clients > may 2004 >

sql server clients : Sum Up


Hugo Kornelis
5/25/2004 11:46:24 AM
[quoted text, click to view]

Hi Noor,

create proc test1 as
select 'Blood Suger' as Alias, 150 as Count
go
create proc test2 as
select 'Blood Pressure' as Alias, 100 as Count
go
create proc test3 as
select 'Body Weight' as Alias, 100 as Count
go
create table #tmptable (Alias varchar(15) not null primary key,
Count int not null)
insert #tmptable(Alias, Count)
execute test1
insert #tmptable(Alias, Count)
execute test2
insert #tmptable(Alias, Count)
execute test3
select sum(Count) as COUNT from #tmptable
go
drop table #tmptable
go
drop proc test1
go
drop proc test2
go
drop proc test3
go


Best, Hugo
--

Noorali Issani
5/25/2004 11:51:32 AM
I have three stored proceudres and I want to sum up the result of three sp,
can any one give me the optimized query.

Exec ALTCmsGetBloodSugar 0,0,1
output :-
Alias Count
Blood Sugar 150

Exec ALTCmsGetBloodPressure 0,0,1

output :-
Alias Count
Blood Pressure 100

Exec ALTCmsGetBodyWeight 0,0,1

output :-
Alias Count
Body Weight 100


Now I want the sum up of all the above count like the output would be

COUNT
350


Thnaks
Noor

AddThis Social Bookmark Button