I have a SP which writes the watermark value after each ADF pipeline run , below is the procedure :
ALTER PROCEDURE [dbo].[usp_write_Time_watermark] @LastModifiedtime datetime, @TableName varchar(50)
AS
BEGIN
UPDATE dbo.Store_Time_Watermarktable
SET [WatermarkValue] = @LastModifiedtime
WHERE [TableName] = @TableName
END
I want to add a condition which says if the lastmodified value is null the set default value as 1900-01-01 00:00:00.000 else take the new lastmodified time. How should i tweak the above procedure
Thanks
You can use the isnull
function, it returns the first non-null of two values.
SET WatermarkValue = isnull(@LastModifiedtime, '19000101')
If you had more than two values you would use coalesce