how to call scalar function in sql server 2008

后端 未结 4 479
迷失自我
迷失自我 2020-12-30 18:26

I have created a Scalar Functions, it was created successfully, but when I call the function using select statement, it says Invalid object name \'dbo.fun_functional_score\

相关标签:
4条回答
  • 2020-12-30 19:03

    For some reason I was not able to use my scalar function until I referenced it using brackets, like so:

    select [dbo].[fun_functional_score]('01091400003')
    
    0 讨论(0)
  • 2020-12-30 19:07

    You have a scalar valued function as opposed to a table valued function. The from clause is used for tables. Just query the value directly in the column list.

    select dbo.fun_functional_score('01091400003')
    
    0 讨论(0)
  • 2020-12-30 19:08

    Your syntax is for table valued function which return a resultset and can be queried like a table. For scalar function do

     select  dbo.fun_functional_score('01091400003') as [er]
    
    0 讨论(0)
  • 2020-12-30 19:08

    For Scalar Function Syntax is

    Select dbo.Function_Name(parameter_name)
    
    Select dbo.Department_Employee_Count('HR')
    
    0 讨论(0)
提交回复
热议问题