Back to OIM Explorer

dbo.QBM_FGIDiskStoreTarget

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 795 characters

Interpretation

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

Relations

  • No extracted relations.

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

Complete Source

SQL43 lines
1CREATE FUNCTION dbo.QBM_FGIDiskStoreTarget(2  @TableName varchar(30)3) RETURNS nvarchar(2564)5AS6BEGIN7  DECLARE @erg nvarchar(256) = NULL8  DECLARE @Tabletype varchar(1) = 'T'9  IF EXISTS(10    SELECT TOP 1 111    FROM sys.tables t12    WHERE13      t.name = 'QBMDiskStoreLogical')14  BEGIN15    SELECT16      TOP 1 @erg = p.Ident_QBMDiskStorePhysical,17      @Tabletype = t.TableType18    FROM dbo.DialogTable t19      WITH(readpast)20    LEFT21    OUTER22    JOIN QBMDiskStoreLogical l23      ON t.uid_QBMDiskStoreLogical = l.UID_QBMDiskStoreLogical24    LEFT25    OUTER26    JOIN QBMDiskStorePhysical p27      ON l.UID_QBMDiskStorePhysical = p.UID_QBMDiskStorePhysical28    WHERE29      t.TableName = @TableName AND t.TableType IN('B',30    'T')31  END32  ELSE33  BEGIN34    SELECT @Tabletype = 'T'35  END36  IF @erg IS NULL AND @Tabletype IN('B',37  'T')38  BEGIN39    SELECT @erg = 'PRIMARY'40  END41  endLabel:42  RETURN(@erg)43END
Open raw exported source
SQL ยท Raw7 lines
1   create   function dbo.QBM_FGIDiskStoreTarget (@TableName varchar(30) ) returns nvarchar(256) as begin declare @erg nvarchar(256) = null declare2 @Tabletype varchar(1) = 'T' if exists (select top 1 1 from sys.tables t where t.name = 'QBMDiskStoreLogical' ) begin select top 1 @erg = p.Ident_QBMDiskStorePhysical3 , @Tabletype = t.TableType from dbo.DialogTable t with (readpast) left outer join QBMDiskStoreLogical l on t.uid_QBMDiskStoreLogical = l.UID_QBMDiskStoreLogical4 left outer join QBMDiskStorePhysical p on l.UID_QBMDiskStorePhysical = p.UID_QBMDiskStorePhysical where t.TableName = @TableName and t.TableType in ('B'5, 'T') end else begin select @Tabletype = 'T'  end if @erg is null and @Tabletype in ('B', 'T') begin select @erg = 'PRIMARY' end endLabel: return(@erg6) end 7