Hi,
I believe this should work, but it is untested because you provided no sample data. 🙂
CREATE PROCEDURE dbo.SP_Template
@Code char(30),
@Path varchar(100) = null,
@PathReadOnly int = null
AS
BEGIN
--set @path = null if it is blank
IF LEN(LTRIM(RTRIM(ISNULL(@path,''))) = 0
SET @path = null
UPDATE m
SET
Path = ISNULL(@Path,m.path),
PathReadOnly = ISNULL(@PathReadOnly,m.PathReadOnly)
FROM dbo.Mytable as m
WHERE Code = @Code
END
The isnull() will return the value from your table if @path/@PathReadOnly is null.
Steffen.