Solved

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

Posted on 2009-05-02
2
208 Views
Last Modified: 2012-05-06
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
Comment
Question by:alfardan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 31

Accepted Solution

by:
RiteshShah earned 500 total points
ID: 24288688
try calling like this.


SELECT * FROM [AdventureWorks].[dbo].[TEST_TABLE] (YOUR PARAMETER VALUE)
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24288691
sorry remove [adventureworks]

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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question