Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Invalid object name...

Author  Topic 

xboxown
Starting Member

1 Post

Posted - 2011-11-23 : 18:17:34
I have a problem... I made a new function in the SQL Server 2008 and when I clicked executed it build and made the function successfuly. But when I go back to the new function that is being build and I click modify function it it puts a jiggly red line underneath the name of the function and it says invalid object name. I cannot use the function in an SQL statement in a query even though the functio n is correct. I am going to paste the function so you can help me and tell me what is wrong with it:

USE [Forum_Invest]
GO
/****** Object: UserDefinedFunction [dbo].[getCashFlowInvItemP] Script Date: 11/23/2011 15:25:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO



--select * from dbo.GetCashFlow('Aug 1, 2010', 'aug 31,2010' )

ALTER function [dbo].[getCashFlowInvItemP](@idEntity int, @StartDate DateTime, @EndDate DateTime, @IdTransactionType int)
Returns @TempGetCashFlowPmtAmount table
(
SalePercentage Decimal(18,2),
IdInventory int,
idProduct int,
Tax1Percent Decimal (18,2),
Tax1 Decimal(18,2),
Tax2Percent Decimal (18,2),
Tax2 Decimal (18,2),
Tax3Percent Decimal (18,2),
Tax3 Decimal (18,2)
)
as
begin

insert into @TempGetCashFlowPmtAmount (SalePercentage, IdInventory, idProduct, Tax1Percent, Tax1, Tax2Percent, Tax2, Tax3Percent, Tax3)
SELECT Tbl_TransactionDetails.totalBeforeTax / Tbl_Transaction.totalItems AS SalePerc, Tbl_Transaction.idTransaction AS IDInv, Tbl_TransactionDetails.idProduct,
Tbl_TransactionDetails.Tax1_percent, Tbl_TransactionDetails.Tax1, Tbl_TransactionDetails.Tax2_Percent, Tbl_TransactionDetails.Tax2,
Tbl_TransactionDetails.Tax3_percent, Tbl_TransactionDetails.Tax3
FROM Tbl_Transaction INNER JOIN
Tbl_TransactionDetails ON Tbl_Transaction.idTransaction = Tbl_TransactionDetails.idTransaction
Where Tbl_TransactionDetails.totalBeforeTax / Tbl_Transaction.totalItems > 0
return
End


nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-24 : 06:01:28
Wrong database, schema, permissions?

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -