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 2000 Forums
 SQL Server Development (2000)
 functions to be passed

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-13 : 07:36:50
Praxeda writes "Hello,
I need to create a function that when passed two columns from two different tables will return the student grades for a class
Grade =
4 when percentage is 90 or above
3 when percentage is 80 or above

this continues till you get to
0 when percentage is below 60.
I've been working on this all day and I can't figure it out.
I'm stuck on Triggers too, I read your articles, but I still am trying to figure them out.

Thanks,
Praxeda (This a real not made up name)"

yonabout
Posting Yak Master

112 Posts

Posted - 2005-12-13 : 08:00:23
Hi,

What are the values being input into the function?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-13 : 08:12:47

Select columns,
Grade=case when percentage >= 90 then 4
when percentage >= 90 then 4
when percentage >= 80 then 3
when percentage >= 70 then 2
.
.
end from yourTable

Otherwise post table structures, sample data and the result you want



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -