Lee Walters


Hi all

I'm trying to re-write the convert function for an upcomming ORACLE conversion that I need to do so and since ORACLE already has a convert function built in a need to write a convert2 function which will be a basic wrapper around the convert function.

If anybody has done something like this before then I would appreciate any help but in the mean time the code I've got so far looks like this

Code Snippet

create function convert2

(

@p1 nvarchar(128),

@p2 nvarchar(128),

@p3 int = NULL -- can't get optional bit to work on this

)

returns sysname

as

BEGIN

return convert(@p1, @p2, @p3)

END

Problem I've got is that the convert function doesn't like having @p1,@p2@p3 passed into it - any ideas on how to get around this

Thanks

Lee




Re: Convert and declared variables

Arnie Rowland


Perhaps this would be better posted in an Oracle forum...




Re: Convert and declared variables

Lee Walters

Arnie

This is nothing to do with Oracle - I've already written the equivalent in that system already - just need a SQL Server version so that my application that uses the convert function can be changed easily without having to maintain two different versions of the code.

Thanks







Re: Convert and declared variables

Arnie Rowland

That is not an issue with a function.

However, a function call MUST be prefixed by the schema (owner), e.g.,

Code Snippet

dbo.CONVERT( @p1, @p2, @p3 )