Solved

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

Posted on 2009-05-02
2
207 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
  • 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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