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.
| Author |
Topic |
|
darenkov
Yak Posting Veteran
90 Posts |
Posted - 2004-11-17 : 00:35:26
|
| Hi, I put this message up yesterday but forgot to make an appropriate subject header.I am trying to create a basic function with the following syntax:CREATE FUNCTION Addition(@Number1 Decimal(6,2), @Number2 Decimal(6,2))RETURNS Decimal(6,2)BEGINDECLARE @Result Decimal(6,2)SET @Result = @Number1 + @Number2RETURN @ResultENDThe problem is that whenever I call it with the code below:PRINT mydatabase.dbo.Addition(1450, 228)I get the following error:Error: Invalid object name 'nobleaccounting.dbo.Addition'I am 100% sure that the database name is correct. Any ideas what else the problem could be?I tried the nest the call statement as suggested by SeventhNight:PRINT (SELECT(mydatabase.dbo.Addition(1450, 228))but that gave me the following error:Error: Subqueries are not allowed in this context. Only scalar expressions are allowedAny ideas? |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-17 : 00:47:40
|
| select mydatabase.dbo.addition(1450,228)orprint mydatabase.dbo.addition(1450,228) worked also--where did you create the object? is mydatabase correct? is the owner of the object dbo?--------------------keeping it simple... |
 |
|
|
|
|
|