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 2005 Forums
 SSIS and Import/Export (2005)
 How to use Raiserror in UDF's

Author  Topic 

sun_psna
Starting Member

4 Posts

Posted - 2008-01-02 : 07:15:00
Im working in a Oracle to SQL migration project, I need to migrate a function
which is using Raiserror()

I have a function in Oracle like this,

create function fn_name( parameters )
returns int
as begin
if ( condition )
-- do some logic
else
raiseerror()
end

I need to migrate this to SQL server 2005.

From next version we wont have Extended procedure, so its better to avoid.
Instead that we can use CLR integration.

Can anyone help me out...

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-02 : 10:54:05
MS SqlServer does not allow the use of RAISERROR within a user-defined function. Common alternative is to use a Stored Procedure instead.

Be One with the Optimizer
TG
Go to Top of Page

sun_psna
Starting Member

4 Posts

Posted - 2008-01-11 : 04:35:00
I changed my functions to procedures.

thanks.
Go to Top of Page
   

- Advertisement -