Link to home
Start Free TrialLog in
Avatar of alfardan
alfardanFlag for United Arab Emirates

asked on

Function created successfully, but when called it gives an error!!

I created a function (check the code below) and it got created successfully.

Now I wanted to execute it, but it gave me the following error message:

Msg 208, Level 16, State 1, Line 2
Invalid object name 'dbo.TEST_TABLE'.

But I can see it there in my list of objects (check attachment1)

Why does it give me this error then?
CREATE FUNCTION TEST_TABLE
(
	@RequestTypeID int
)
RETURNS 
@MyTable TABLE 
(
	SystemID int, 
	DateOfSubmission datetime
)
AS
BEGIN
	insert @MyTable
	select Application_ID, Date_of_Submission from dbo.Request2_Log
	return
END

Open in new window

function.JPG
ASKER CERTIFIED SOLUTION
Avatar of RiteshShah
RiteshShah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry remove [adventureworks]

SELECT * FROM [dbo].[TEST_TABLE] (<@RequestTypeID, int,>)