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)
 Function and Procedure

Author  Topic 

Ben_Almighty
Starting Member

2 Posts

Posted - 2009-11-19 : 20:04:25
Hi All,

I am new to SQL Server 2008 and I am currently facing some difficulty about SQL Server. I am just wondering can a Procedure be written in a user define function(which I seriously doubt is possible)? As I come across a function in Oracle that did just that. If it is not possible can anyone suggest a round about.

Any help is greatly appreaciated.

Thank

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-19 : 20:29:37
What do you need to accomplish? Give us a few specifics about your situation and we'll try to help
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-19 : 21:55:08
Why would you want to do that?

Are you trying to a conversion?

Somethings just don't (or shouldn't) convert

How does it even make sense in Oracle?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-20 : 01:30:10
quote:
Originally posted by Ben_Almighty

Hi All,

I am new to SQL Server 2008 and I am currently facing some difficulty about SQL Server. I am just wondering can a Procedure be written in a user define function(which I seriously doubt is possible)? As I come across a function in Oracle that did just that. If it is not possible can anyone suggest a round about.

Any help is greatly appreaciated.

Thank


Post the procedure code that you want to be as a function

Madhivanan

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

Ben_Almighty
Starting Member

2 Posts

Posted - 2009-11-23 : 19:53:58
Hi guys,

Sorry for the late reply.
The code below are from Oracle,

CURSOR INSTRUCTION_CUR
IS
SELECT StorerKey, Sku
FROM INSTRUCTION
WHERE ( INSTRUCTIONDETAIL.INSTRUCTIONTYPE = pInstructionType ) ;

PROCEDURE PROCESS_INSTRUCTION
(lpStorerKey in VARCHAR2, lpSku in VARCHAR2,
lpCountryOfOrigin in VARCHAR2, lpCountry in VARCHAR2, lpPort in VARCHAR2, lpPartnerKey in VARCHAR2,
lpRecRelType in VARCHAR2, lpInstructionLevel out VARCHAR2, lpInstructionFilter out VARCHAR2 )
IS
BEGIN

*****some code ran here *****
*****some code ran here *****
*****some code ran here *****
*****some code ran here *****

END;

PROCESS_INSTRUCTION(INSTRUCTION_REC.StorerKey);


Basically, there is a Procedure embedded in a Function. And during the execution of this code, the Procedure is called within the function. Can it be done in MS SQL Server 2008? Or the Procedure and Function has to be created separately? Understand the detail is a little stretchy here, but if need I can post the entire code. But it will be lenghty.

Thank for your help

Regards,
B.H
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-25 : 01:02:29
No. It is not possible. They need to be created seperately

Madhivanan

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

- Advertisement -