Back to OIM Explorer

dbo.QBM_FSQTypeDef

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 954 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_FSQColumDef source text reference
  • references source dbo.QBM_FSQIndexDef source text reference
  • references source dbo.QBM_FSQPrimaryKeyDef source text reference
  • references source dbo.QBM_FSQPrimaryKeyDef_S source text reference

References

Referenced By

  • No direct source references extracted.

Complete Source

SQL49 lines
1CREATE FUNCTION dbo.QBM_FSQTypeDef(2  @TypeName nvarchar(64)3) RETURNS nvarchar(max4)5AS6BEGIN7  DECLARE @erg nvarchar(max) = ''8  DECLARE @section nvarchar(max)9  IF NOT EXISTS(10    SELECT TOP 1 111    FROM sys.table_types t12    WITH(readpast)13  WHERE14    t.name = @TypeName)15  BEGIN16    GOTO endLabel17  END18  SELECT19    @erg = dbo.QBM_FSQColumDef(@TypeName,20    '%')21  SELECT22    @section = dbo.QBM_FSQIndexDef(@TypeName,23    '%')24  IF @section > ' '25  BEGIN26    SELECT @erg = @erg + char(13) + char(10) + char(13) + char(10) + @section27  END28  SELECT @section = dbo.QBM_FSQPrimaryKeyDef_S(@TypeName)29  IF @section > ' '30  BEGIN31    SELECT @erg = @erg + char(13) + char(10) + '	' + @section + '32'33  END34  SELECT @erg = 'Create Type ' + @TypeName + ' as table (35' + @erg + '36				)'37  IF EXISTS(38    SELECT TOP 1 139    FROM sys.table_types t40    WITH(readpast)41  WHERE42    t.name = @TypeName AND t.is_memory_optimized = 1)43  BEGIN44    SELECT @erg = @erg + '45	with (MEMORY' + '_' + 'OPTIMIZED = ON)'46  END47  endLabel:48  RETURN(@erg)49END
Open raw exported source
SQL ยท Raw12 lines
1    create   function dbo.QBM_FSQTypeDef (@TypeName nvarchar(64)) returns nvarchar(max) as begin declare @erg nvarchar(max) = '' declare @section2 nvarchar(max) if not exists (select top 1 1 from sys.table_types t with (readpast) where t.name = @TypeName ) begin goto endLabel end  select @erg = dbo.QBM_FSQColumDef3(@TypeName, '%')  select @section = dbo.QBM_FSQIndexDef(@TypeName, '%') if @section > ' ' begin select @erg = @erg + char(13) + char(10) + char(13) + char4(10) + @section end  select @section = dbo.QBM_FSQPrimaryKeyDef_S(@TypeName) if @section > ' ' begin select @erg = @erg + char(13) + char(10) + '	' + @section5 +'6' end  select @erg = 'Create Type ' + @TypeName + ' as table (7' + @erg + '8				)' if exists (select top 1 1 from sys.table_types t with (readpast9) where t.name = @TypeName and t.is_memory_optimized = 1 ) begin select @erg = @erg + '10	with (MEMORY' + '_' + 'OPTIMIZED = ON)' end endLabel: return(@erg11) end 12