ZedZip
ZedZip

Reputation: 6462

How to replace function REPLACE() in Natively-compiled module?

I convert my old stored procedure (SQL Server 2016) to a natively compiled procedure and in one place I receive:

SELECT @name = REPLACE(@inname, ':' + @new + ':', ':' + @old + ':')

Msg 10794, Level 16, State 93, Procedure usp_2, Line 101 [Batch Start Line 108]
The function 'replace' is not supported with natively compiled modules.

How to replace the function REPLACE()?

Upvotes: 0

Views: 227

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 88852

The typical pattern is to use an ordinary a TSQL procedure wrapper and a natively-compiled sub-procedure. The TSQL wrapper performs any unsupported operations before calling the natively-compiled procedure and handles retry in case of optimistic concurrency exceptions.

Upvotes: 1

Related Questions