多部分标识符“sdb.dbo.getempbygender”无法受约束。 [英] The multi-part identifier "sdb.dbo.getempbygender" could not be bound.
问题描述
我的桌子(emp):
列数据类型Allownulls
Id int否
名称varchar(50)是
Dateofbirth date yes
性别varchar(50)是
Deprtmentid varchar(50)是
我的功能:
My table(emp):
Column Datatype Allownulls
Id int No
Name varchar(50) Yes
Dateofbirth date yes
Gender varchar(50) Yes
Deprtmentid varchar(50) Yes
My function:
USE [sdb]
GO
/****** Object: UserDefinedFunction [dbo].[getempbygender] Script Date: 09/02/2016 19:41:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create function [dbo].[getempbygender](@Gender varchar(50))
returns table
as
return( select Id,Name,Dateofbirth,Deprtmentid from emp where Gender=@Gender ).
每当执行'命令成功完成' msg将被给出但是在调用时函数错误将像一样抛出Msg 4104,Level 16,State 1,Line 1
多部分标识符dbo.getempbygender无法绑定。
调用该功能:
whenever excute 'Command(s) completed successfully' msg will be given but while call the function error will thrown like as "Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "dbo.getempbygender" could not be bound."
call the function:
select [dbo].[getempbygender] 'Male'
请帮助我。
谢谢你
我尝试过:
每当执行'命令已成功完成' msg将被给出,但在调用时,函数错误将被抛出,如消息4104,等级16,状态1,行1 >
多部分标识符dbo.getempbygender无法绑定。
pls help me.
Thank u
What I have tried:
whenever excute 'Command(s) completed successfully' msg will be given but while call the function error will thrown like as "Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "dbo.getempbygender" could not be bound."
推荐答案
您对函数的调用是错误的。它应该是从[dbo]中选择*。[getempbygender]('男')
更新了Richard的更正。
Your call to your function is wrong. It should be select * from [dbo].[getempbygender]('Male')
Updated with correction from Richard.
这篇关于多部分标识符“sdb.dbo.getempbygender”无法受约束。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!