• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

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
0
alfardan
Asked:
alfardan
  • 2
1 Solution
 
RiteshShahCommented:
try calling like this.


SELECT * FROM [AdventureWorks].[dbo].[TEST_TABLE] (YOUR PARAMETER VALUE)
0
 
RiteshShahCommented:
sorry remove [adventureworks]

SELECT * FROM [dbo].[TEST_TABLE] (<@RequestTypeID, int,>)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now