Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 for each id add row

Author  Topic 

asafg
Starting Member

39 Posts

Posted - 2009-02-01 : 04:52:21
I have a list of students id... 1111,1112,1113....

I have a function which returns a row of a student grades:
row=fun_getStudentGrades(id)

I want to know what is the best way to build a table with all students grade:

1111,90,85,77,99
1112,65,87,88,89
1113,97,96,93,99
...

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2009-02-01 : 06:04:08
You've not really given us enough to go on. What format is the data, where is it stored now, where to the grades come from, what columns are you after, what language are you using etc.

From what I can see you're proposed table is not the way to go. I'mguessing here, but it lookslike you need at least these tables:
Student
Course
StudentCourseGrade
Go to Top of Page

asafg
Starting Member

39 Posts

Posted - 2009-02-01 : 06:18:01
It's a theoretical question about using data from table a as input for a stored procedure that creates a new table.
If it is important... I have a list in excel of people for whom I need to find their data.

I have a list of people that arrived today at 10:00 ---> excel list (my manager caught them coming late)
and I want to check in the DB if they always come late at 10:00 ---> DB info(log of employees arrival time)

Result
id 1/1/2009 2/1/2009 3/1/2009....today
1 08:05 08:30 07:10 10:00
2 08:30 08:30 08:30 10:00
3 11:03 11:30 10:59 10:00 (- this one is going home)

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-01 : 10:46:28
Where is the Sample data?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-01 : 12:32:02
seems like what you need is use OPENROWSET() to get data from excel and then join it with yourtable to get the data for other days. then use PIVOT() operator to get dates as columns.
If you need more help, you need to post some data and explain what you want with output.
Go to Top of Page
   

- Advertisement -