Home Forums SQL Server 7,2000 T-SQL How to give Parameter value to the function RE: How to give Parameter value to the function

  • Newbi - Saturday, August 12, 2017 11:51 PM

    Thank you for your reply and correcting my code. That parameter @EmpID I am trying to pass can't really passed into the function. I am having a gap I guess. My Application is always warning me "Must declare scalar value" for the function.

    In your client application, I presume you're displaying information for one employee (in response to a click or some other event) or for a group of employees (for a page) at once.

    If you're showing a single employee, the example query above can be called from your .NET code.  If you're displaying a page, you should be able to use something similar to the following to include the data from the function.


    SELECT TOP 20 e.FirstName, e.LastName, p.TaxableIncome
      FROM dbo.EmpTable e
        CROSS APPLY dbo.fn_CalculateNetPay(e.EmpID) p
      WHERE whatever_your_using_to_return_a_page_of_rows_to_display
      ORDER BY e.LastName;