Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server2000, i try to use function 1

Status
Not open for further replies.

duchovnick

Programmer
Jan 4, 2007
115
IL
Hi,
I try to work with functions but i end by working with errors.
The following is the code to make a function
Code:
CREATE FUNCTION aaa (@myDigit INTEGER)
RETURNS INTEGER
AS
BEGIN
  RETURN @myDigit
END
and the following is the code calling that function:
Code:
CREATE PROCEDURE bbb @hisDigit INTEGER
AS
BEGIN TRANSACTION
PRINT aaa(@hisDigit)
COMMIT
i couldnt run the above code because during compilation i recieved the following
error message:
Server: Msg 195, Level 15, State 10, Procedure bbb, Line 4
'aaa' is not a recognized function name.
Can anyone tell me what my error is?
Thanks a lot !
 
Do you really think a transaction is necessary for a 'print' command, or is this just in order to provide a simple example?

Anyway, you need to reference UDF like this in your sp:

Code:
dbo.aaa(@hisDigit)

Hope it helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Hi Alex,
Yes, I made it as simple as i could.
Thanks a lot .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top