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
 problem in function

Author  Topic 

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-01 : 01:20:26
hi, this is my table output

select * from emp1
name age id
--------------------
karthik 24 1
muniraj 200 11
vvv 22 12
puppy 111 14
qqqqqqq 24 15
krishna 0 24

i have return function like this:

CREATE FUNCTION age1(@age int)
RETURNS TABLE
AS
RETURN SELECT name,id
FROM emp1
WHERE age=@age
so if o give select dbo.age1(24) it has to give name and id of the age 24,but it gives the folowing error:

Invalid object name 'dbo.age1'.

please help me to do this


khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-01 : 01:24:26
age1 is a function table not a scalar function. You should call it this way

select * from age1(24)




KH

Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-01 : 01:38:12
hi khtan thanks a lot for ur help i got it
Go to Top of Page
   

- Advertisement -