Back to OIM Explorer

dbo.QBM_FCVStringToDatetime_BU

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 474 characters

Interpretation

  • Database function. Usually supports views, validation, or calculated predicates; look at referenced-by entries for callers.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QBM_FCVStringToDatetime source text reference

Complete Source

SQL34 lines
1CREATE FUNCTION dbo.QBM_FCVStringToDatetime_BU(2  @in nvarchar(400)3) RETURNS datetime4  WITH SCHEMABINDING5AS6BEGIN7  DECLARE @erg datetime = NULL8  DECLARE @isDate BIT = 09  SELECT @isDate = isdate(@in)10  IF @isDate = 111  BEGIN12    IF13    RIGHT(@in,14    1) = 'Z'15    BEGIN16      SELECT17        @erg = try_convert(datetime,18        @in,19        127)20    END21    ELSE22    BEGIN23      SELECT24        @erg = try_convert(datetime,25        @in,26        121)27    END28  END29  IF @isDate = 0 OR @erg IS NULL OR @erg = '1899-12-30'30  BEGIN31    SELECT @erg = NULL32  END33  RETURN(@erg)34END
Open raw exported source
SQL ยท Raw5 lines
1   create   function dbo.QBM_FCVStringToDatetime_BU(@in nvarchar(400)) returns datetime with SCHEMABINDING as begin declare @erg datetime = null2 declare @isDate bit = 0 select @isDate = isdate(@in)  if @isDate = 1 begin if right(@in, 1) = 'Z' begin select @erg = try_convert(datetime, @in, 127) 3end else begin select @erg = try_convert(datetime, @in, 121) end end if @isDate = 0 or @erg is null or @erg = '1899-12-30' begin select @erg = null  end4 return (@erg) end 5