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 2000 Forums
 Transact-SQL (2000)
 calling function in sp

Author  Topic 

dehseth
Starting Member

18 Posts

Posted - 2006-12-25 : 09:44:29
hi ppl,
seems like the trouble never ends...

i need to call function inside of a SP, but seems like not allowed.
i got ths error:
Only functions and extended stored procedures can be executed from within a function.

when i try to execute this statement:

exec sp_getnext 'KMGMAT', 'memurbordro_maas', '2', 1

sp_getnext is a SP which uses getnext function in it.

how can i solve this problem?

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-12-25 : 10:22:56
for calling the function you need to rap them up in the Select statement

Select GetNext(Parameters)

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

dehseth
Starting Member

18 Posts

Posted - 2006-12-25 : 10:43:15
quote:
Originally posted by chiragkhabaria

for calling the function you need to rap them up in the Select statement

Select GetNext(Parameters)

Chirag

http://chirikworld.blogspot.com/



not working.. can u give me an example? I need to call function in stored procedure..
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-12-25 : 11:29:01
what is the function name.. can you post the code of your stored procedure?

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

dehseth
Starting Member

18 Posts

Posted - 2006-12-25 : 11:39:45
seems like the problem is execute statament which i am using in my function. when i remove it from the function it doesn't give that error to me. the thing is i cannot use exec | execute in functions or anything related with functions like: if i create a SP which includes exec command and call this SP in a function; it gives me the same error.
so my problem becomes how can i use exec | execute statment in a function?
the answer's maybe CLR. i am gonna try to write some c# code and make it a dll, load it to sql server. and try to use that assembly.

anyone got better idea?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-25 : 22:11:23
quote:
Originally posted by dehseth

seems like the problem is execute statament which i am using in my function. when i remove it from the function it doesn't give that error to me. the thing is i cannot use exec | execute in functions or anything related with functions like: if i create a SP which includes exec command and call this SP in a function; it gives me the same error.
so my problem becomes how can i use exec | execute statment in a function?
the answer's maybe CLR. i am gonna try to write some c# code and make it a dll, load it to sql server. and try to use that assembly.

anyone got better idea?


What is the error you are getting?
Show us the code you used

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -