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
 General SQL Server Forums
 New to SQL Server Programming
 How to find top3 salary dynamically

Author  Topic 

prasaditc55
Starting Member

8 Posts

Posted - 2012-07-24 : 06:04:32
Hi,

I want to find top3 salary dynamically from employee table using user defined function.

Note: 3 want to be passed at runtime, It means must be possible to pass any number.

Thanks,
Bhanu

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-07-24 : 06:11:02
Refer this
http://beyondrelational.com/modules/2/blogs/70/posts/10845/return-top-n-rows.aspx

Madhivanan

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-24 : 09:36:27
quote:
Originally posted by prasaditc55

Hi,

I want to find top3 salary dynamically from employee table using user defined function.

Note: 3 want to be passed at runtime, It means must be possible to pass any number.

Thanks,
Bhanu


whats purpose of making udf?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

prasaditc55
Starting Member

8 Posts

Posted - 2012-07-24 : 23:41:41
@visakh, I dosent know wat input i am gng to pass. It may any number.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-25 : 01:04:34
quote:
Originally posted by prasaditc55

@visakh, I dosent know wat input i am gng to pass. It may any number.


isnt it enough to make it procedure then?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -