here my code-
create function dbo.emptable()
returns Table
as
return (select id, name, salary from employee)
go
select dbo.emptable()
error: Msg 4121, Level 16, State 1, Line 1 Cannot find either column "dbo" or the user-defined function or aggregate "dbo.emptable", or the name is ambiguous.
while when I run
sp_helptext emptable
it shows-
create function dbo.emptable()
retu开发者_JS百科rns Table
as
return (select id, name, salary from employee)
it means function exists in database then why it is giving such error?
Is it because when you select from the function you need to say
select * from dbo.emptable()
not
select dbo.emptable()
select * from dbo.emptable()
It's a table, after all...
精彩评论