Hi All,
We have bulk load jobs configured using SSIS packages. All the load jobs were working perfectly fine until 2 days back. Suddenly, our load jobs are taking way longer than the normal time. The issue is identified to be the use of UDF as shown below,
Note: These jobs were working fine since 3 years without any issues. We load around 16 GB of data each day.
No changes to the server and\or SQL Server itself.
Any help would be greatly appreciated.
Thanks,
-Mohsin
ALTER FUNCTION [dbo].[convertdate_null](@input varchar(50))
RETURNSVARCHAR(12)
AS
BEGIN
DECLARE @outputDATETIME;
SELECT @output=CASE WHEN (ISDATE((CASEWHEN Left(replace(ltrim(rtrim(@input)),'+',''), 1)= 1
THEN'20'
ELSE'19'
END +Right(ltrim(rtrim(@input)), 6))
)= 1)
THENCONVERT(VARCHAR(12),CONVERT(DATETIME,CASEWHEN Left(replace(ltrim(rtrim(@input)),'+',''), 1)= 1
THEN'20'
ELSE'19'
END +Right(ltrim(rtrim(@input)), 6)) )
ELSE
null
END
RETURN @output
END