Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Sub-Query Help 22 62
Select record with the most recent date 14 54
SQL Server - Find Parent/Child relationship tree between numeric range. 7 41
Sql Server group by 10 26
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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