I have the following stored procedure:
ALTER PROCEDURE [dbo].[UpPro]
(
@PN varchar(200),
@xml xml,
@gVa varchar(10),
)
AS
/* update the gender */
The error actually says it all, @XML
is null and that is not allowed.
Repro:
declare @X xml;
set @X.modify('replace value of text()[1] with "1"');
Msg 5302, Level 16, State 1, Line 4 Mutator 'modify()' on '@X' cannot be called on a null value.
Check for null before you modfy.
declare @X xml;
if @X is not null
set @X.modify('replace value of text()[1] with "1"');