question

tsaliki avatar image
tsaliki asked

SQl server stored procedure help

i have a table like below: create table testjob ( jobid int, jobname varchar(100), time float, name varchar(50) ) insert into testjob values ( 1001,'java work',4.5,'arjun') insert into testjob values ( 1005,'sql work',10,'arjun') insert into testjob values ( 1010,'.net work',7.5,'arjun') insert into testjob values ( 1040,'java work',5.5,'ravi') insert into testjob values ( 1023,'php work',2.5,'arjun') insert into testjob values ( 1027,'.net work',3.5,'ravi') i want a procedure so that my output as below in the html format like below: Name:Arjun(24.5 Hrs spent) jobname Time java work 4.5 sql work 10 .net work 7.5 php work 2.5 Name:Ravi(9 Hrs spent) jobname time java work 5.5 .net work 3.5
sql-server-2005stored-procedureshtml
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

topic does not fit in the meta-section of ask_ssc
0 Likes 0 ·

1 Answer

·
SteveHood79 avatar image
SteveHood79 answered
Playing with formatting or creating HTML is not the best use for SQL Server. The results you'd want an external program to handle would be: SELECT name , SumTime = SUM([Time]) OVER(PARTITION BY name) , JobName , [Time] FROM testjob
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.