microsoft / mssql-jdbc

The Microsoft JDBC Driver for SQL Server is a Type 4 JDBC driver that provides database connectivity with SQL Server through the standard JDBC application program interfaces (APIs).
MIT License
1.05k stars 424 forks source link

DatabaseMetadata.getColumns(...) is not returning all columns of the table/ view #1859

Closed tufailkhan89 closed 2 years ago

tufailkhan89 commented 2 years ago

SQL Server version Microsoft SQL Azure (RTM) - 12.0.2000.8 May 12 2022 23:11:24 Copyright (C) 2022 Microsoft Corporation

Driver Version 10.2 Reference Link: https://go.microsoft.com/fwlink/?linkid=2195718

Client Operating System CentOS Linux release 7.9.2009 (Core)

JAVA/JVM version java version "1.8.0_311" Java(TM) SE Runtime Environment (build 1.8.0_311-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)

Table schema Table Creation: ProductCategory

/****** Object:  Table [SalesLT].[ProductCategory]    Script Date: 7/1/2022 10:14:09 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [SalesLT].[ProductCategory](
    [ProductCategoryID] [int] IDENTITY(1,1) NOT NULL,
    [ParentProductCategoryID] [int] NULL,
    [Name] [dbo].[Name] NOT NULL,
    [rowguid] [uniqueidentifier] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ProductCategory_ProductCategoryID] PRIMARY KEY CLUSTERED 
(
    [ProductCategoryID] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [AK_ProductCategory_Name] UNIQUE NONCLUSTERED 
(
    [Name] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [AK_ProductCategory_rowguid] UNIQUE NONCLUSTERED 
(
    [rowguid] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [SalesLT].[ProductCategory] ADD  CONSTRAINT [DF_ProductCategory_rowguid]  DEFAULT (newid()) FOR [rowguid]
GO

ALTER TABLE [SalesLT].[ProductCategory] ADD  CONSTRAINT [DF_ProductCategory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
GO

ALTER TABLE [SalesLT].[ProductCategory]  WITH CHECK ADD  CONSTRAINT [FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID] FOREIGN KEY([ParentProductCategoryID])
REFERENCES [SalesLT].[ProductCategory] ([ProductCategoryID])
GO

ALTER TABLE [SalesLT].[ProductCategory] CHECK CONSTRAINT [FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID]
GO

View Creation: vGetAllCategories

/****** Object:  View [SalesLT].[vGetAllCategories]    Script Date: 7/1/2022 10:08:33 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [SalesLT].[vGetAllCategories]
WITH SCHEMABINDING
AS
-- Returns the CustomerID, first name, and last name for the specified customer.
WITH CategoryCTE([ParentProductCategoryID], [ProductCategoryID], [Name]) AS
(
    SELECT [ParentProductCategoryID], [ProductCategoryID], [Name]
    FROM SalesLT.ProductCategory
    WHERE ParentProductCategoryID IS NULL

UNION ALL

    SELECT C.[ParentProductCategoryID], C.[ProductCategoryID], C.[Name]
    FROM SalesLT.ProductCategory AS C
    INNER JOIN CategoryCTE AS BC ON BC.ProductCategoryID = C.ParentProductCategoryID
)

SELECT PC.[Name] AS [ParentProductCategoryName], CCTE.[Name] as [ProductCategoryName], CCTE.[ProductCategoryID]
FROM CategoryCTE AS CCTE
JOIN SalesLT.ProductCategory AS PC
ON PC.[ProductCategoryID] = CCTE.[ParentProductCategoryID]
GO

Problem description When we try to fetch Column details for a specific table, the JDBC driver is not providing details of all the columns.

Connection connection = connectionSQLServer()
DatabaseMetaData dbMetadata = connection.getMetaData();
ResultSet rs = dbMetadata.getColumns(null, "SalesLT", "vGetAllCategories", null);

Here ResultSet (rs) only returns column information for ProductCategoryID and not for the other two columns.

and When we execute SELECT TOP (1000) * FROM [SalesLT].[vGetAllCategories] then it shows three column

A similar issue can be seen in Microsoft Azure Query editor (preview)

image

Expected behavior All columns metadata should be returned.

Actual behavior Only one columns metadata is provided in the result.

tkyc commented 2 years ago

Hi, we'll do some investigating and get back to you.

tufailkhan89 commented 2 years ago

Please do let us know if there is any workaround.

tkyc commented 2 years ago

Hi @tufailkhan89, apologies for the very late response, the team was busy dealing with an internal problem.

I've attempted to reproduce the problem with no success. On my end, with my own database/tables, I was able to get all column information with the DatabaseMetadata.getColumns function of my view.

However, I want to confirm if the problem occurs only with your database/table setup. I'll attempt another repro with a more exact copy of your setup, but in the mean time could you share the following info? Could you run the following code with your ResultSet?

Connection connection = connectionSQLServer()
DatabaseMetaData dbMetadata = connection.getMetaData();
ResultSet rs = dbMetadata.getColumns(null, "SalesLT", "vGetAllCategories", null);

while (rs.next()) {
    for (int i = 1; i <= 32; i++) {
        System.out.printf("%d: %s \s", i, rs.getString(i));
    }
    System.out.print("\n");
}

Just double checking with the above code. So it prints out only one row of information for you?

tkyc commented 2 years ago

Could you run the following query in SSMS for your view and let me know what you get (set @P0 to your view name)? The following query is what the driver sends to the server for execution to get the database metadata.

declare @P0 nvarchar(4000),@P1 nvarchar(4000),@P2 nvarchar(4000),@P3 nvarchar(4000),@P4 int,@P5 int

set @P0 = 'your-view-name';
set @P1 = null;
set @P2 = null;
set @P3 = null;
set @P4 = 2;
set @P5 = 3;

DECLARE @mssqljdbc_temp_sp_columns_result 
TABLE(TABLE_QUALIFIER SYSNAME, TABLE_OWNER SYSNAME,TABLE_NAME SYSNAME, COLUMN_NAME SYSNAME, DATA_TYPE SMALLINT, 
TYPE_NAME SYSNAME, PRECISION INT,LENGTH INT, SCALE SMALLINT, RADIX SMALLINT, NULLABLE SMALLINT, REMARKS VARCHAR(254), 
COLUMN_DEF NVARCHAR(4000),SQL_DATA_TYPE SMALLINT, SQL_DATETIME_SUB SMALLINT, CHAR_OCTET_LENGTH INT, ORDINAL_POSITION INT,
IS_NULLABLE VARCHAR(254), SS_IS_SPARSE SMALLINT, SS_IS_COLUMN_SET SMALLINT, SS_IS_COMPUTED SMALLINT,SS_IS_IDENTITY SMALLINT, 
SS_UDT_CATALOG_NAME NVARCHAR(128), SS_UDT_SCHEMA_NAME NVARCHAR(128),SS_UDT_ASSEMBLY_TYPE_NAME NVARCHAR(max), SS_XML_SCHEMACOLLECTION_CATALOG_NAME 
NVARCHAR(128),SS_XML_SCHEMACOLLECTION_SCHEMA_NAME NVARCHAR(128), SS_XML_SCHEMACOLLECTION_NAME NVARCHAR(128),SS_DATA_TYPE TINYINT);
INSERT INTO @mssqljdbc_temp_sp_columns_result EXEC sp_columns_100 @P0, @P1, @P2, @P3, @P4, @P5;SELECT TABLE_QUALIFIER AS TABLE_CAT, TABLE_OWNER 
AS TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE,TYPE_NAME, PRECISION AS COLUMN_SIZE, LENGTH AS BUFFER_LENGTH, SCALE AS DECIMAL_DIGITS, 
RADIX AS NUM_PREC_RADIX,NULLABLE, REMARKS, COLUMN_DEF, SQL_DATA_TYPE, SQL_DATETIME_SUB, CHAR_OCTET_LENGTH, ORDINAL_POSITION, IS_NULLABLE,NULL 
AS SCOPE_CATALOG, NULL AS SCOPE_SCHEMA, NULL AS SCOPE_TABLE, SS_DATA_TYPE AS SOURCE_DATA_TYPE,
CASE SS_IS_IDENTITY WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' WHEN '' THEN '' END AS IS_AUTOINCREMENT,
CASE SS_IS_COMPUTED WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' WHEN '' THEN '' END AS IS_GENERATEDCOLUMN, SS_IS_SPARSE, SS_IS_COLUMN_SET, SS_UDT_CATALOG_NAME, 
SS_UDT_SCHEMA_NAME, SS_UDT_ASSEMBLY_TYPE_NAME,SS_XML_SCHEMACOLLECTION_CATALOG_NAME, SS_XML_SCHEMACOLLECTION_SCHEMA_NAME, SS_XML_SCHEMACOLLECTION_NAME 
FROM @mssqljdbc_temp_sp_columns_result ORDER BY TABLE_CAT, TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION;
tufailkhan89 commented 2 years ago

Could you run the following query in SSMS for your view and let me know what you get (set @p0 to your view name)? The following query is what the driver sends to the server for execution to get the database metadata.

declare @P0 nvarchar(4000),@P1 nvarchar(4000),@P2 nvarchar(4000),@P3 nvarchar(4000),@P4 int,@P5 int

set @P0 = 'your-view-name';
set @P1 = null;
set @P2 = null;
set @P3 = null;
set @P4 = 2;
set @P5 = 3;

DECLARE @mssqljdbc_temp_sp_columns_result 
TABLE(TABLE_QUALIFIER SYSNAME, TABLE_OWNER SYSNAME,TABLE_NAME SYSNAME, COLUMN_NAME SYSNAME, DATA_TYPE SMALLINT, 
TYPE_NAME SYSNAME, PRECISION INT,LENGTH INT, SCALE SMALLINT, RADIX SMALLINT, NULLABLE SMALLINT, REMARKS VARCHAR(254), 
COLUMN_DEF NVARCHAR(4000),SQL_DATA_TYPE SMALLINT, SQL_DATETIME_SUB SMALLINT, CHAR_OCTET_LENGTH INT, ORDINAL_POSITION INT,
IS_NULLABLE VARCHAR(254), SS_IS_SPARSE SMALLINT, SS_IS_COLUMN_SET SMALLINT, SS_IS_COMPUTED SMALLINT,SS_IS_IDENTITY SMALLINT, 
SS_UDT_CATALOG_NAME NVARCHAR(128), SS_UDT_SCHEMA_NAME NVARCHAR(128),SS_UDT_ASSEMBLY_TYPE_NAME NVARCHAR(max), SS_XML_SCHEMACOLLECTION_CATALOG_NAME 
NVARCHAR(128),SS_XML_SCHEMACOLLECTION_SCHEMA_NAME NVARCHAR(128), SS_XML_SCHEMACOLLECTION_NAME NVARCHAR(128),SS_DATA_TYPE TINYINT);
INSERT INTO @mssqljdbc_temp_sp_columns_result EXEC sp_columns_100 @P0, @P1, @P2, @P3, @P4, @P5;SELECT TABLE_QUALIFIER AS TABLE_CAT, TABLE_OWNER 
AS TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE,TYPE_NAME, PRECISION AS COLUMN_SIZE, LENGTH AS BUFFER_LENGTH, SCALE AS DECIMAL_DIGITS, 
RADIX AS NUM_PREC_RADIX,NULLABLE, REMARKS, COLUMN_DEF, SQL_DATA_TYPE, SQL_DATETIME_SUB, CHAR_OCTET_LENGTH, ORDINAL_POSITION, IS_NULLABLE,NULL 
AS SCOPE_CATALOG, NULL AS SCOPE_SCHEMA, NULL AS SCOPE_TABLE, SS_DATA_TYPE AS SOURCE_DATA_TYPE,
CASE SS_IS_IDENTITY WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' WHEN '' THEN '' END AS IS_AUTOINCREMENT,
CASE SS_IS_COMPUTED WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' WHEN '' THEN '' END AS IS_GENERATEDCOLUMN, SS_IS_SPARSE, SS_IS_COLUMN_SET, SS_UDT_CATALOG_NAME, 
SS_UDT_SCHEMA_NAME, SS_UDT_ASSEMBLY_TYPE_NAME,SS_XML_SCHEMACOLLECTION_CATALOG_NAME, SS_XML_SCHEMACOLLECTION_SCHEMA_NAME, SS_XML_SCHEMACOLLECTION_NAME 
FROM @mssqljdbc_temp_sp_columns_result ORDER BY TABLE_CAT, TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION;

@tkyc I executed the above query in Microsoft Azure Query editor (preview) and got just one column in response.

image

But the select query on the same view returns 3 columns as seen below.

image
tufailkhan89 commented 2 years ago

Hi @tufailkhan89, apologies for the very late response, the team was busy dealing with an internal problem.

I've attempted to reproduce the problem with no success. On my end, with my own database/tables, I was able to get all column information with the DatabaseMetadata.getColumns function of my view.

However, I want to confirm if the problem occurs only with your database/table setup. I'll attempt another repro with a more exact copy of your setup, but in the mean time could you share the following info? Could you run the following code with your ResultSet?

Connection connection = connectionSQLServer()
DatabaseMetaData dbMetadata = connection.getMetaData();
ResultSet rs = dbMetadata.getColumns(null, "SalesLT", "vGetAllCategories", null);

while (rs.next()) {
    for (int i = 1; i <= 32; i++) {
        System.out.printf("%d: %s \s", i, rs.getString(i));
    }
    System.out.print("\n");
}

Just double checking with the above code. So it prints out only one row of information for you?

@tkyc I Executed the above mentioned java code, and the program returned only 1 row. Result is given below 1: zaloniaworks \s2: SalesLT \s3: vGetAllCategories \s4: ProductCategoryID \s5: 4 \s6: int \s7: 10 \s8: 4 \s9: 0 \s10: 10 \s11: 1 \s12: null \s13: null \s14: 4 \s15: null \s16: null \s17: 3 \s18: YES \s19: null \s20: null \s21: null \s22: 38 \s23: NO \s24: NO \s25: 0 \s26: 0 \s27: null \s28: null \s29: null \s30: null \s31: null \s32: null \s

tkyc commented 2 years ago

Hi @tufailkhan89, thanks for the additional info. This issue is still on my radar. At the moment the team is preparing for release, so I'll need to put a pause on investigating.

tkyc commented 2 years ago

Hi @tufailkhan89,

I was playing around with the tables some more (using your provided queries). Unfortunately, I'm still unable to repro the issue. Using your schemas and the exact SQL Server version, I was able to get all 3 columns. Capture

Just one clarifying question, for the table creation, is the [dbo].[Name] a user defined type? If so what was the query used to create it? I was using create type Name from varchar(255) (maybe this difference is the reason I'm not able to exactly repro your problem).

Also, just curious, could you also try and repro the issue on a fresh database and table? I want to see if the cause is unique to your current setup.

tkyc commented 2 years ago

Hi, is there any update?

tkyc commented 2 years ago

Closing for inactivity. We can reopen later if necessary.

www-viveksharma commented 2 years ago

I am seeing the exact same issue and in my case looks like newly added columns (via ALTER TABLE) are the ones that are not being returned by the getColumns() call.

Sample: DatabaseMetaData returned Ordinals & Columns -vs- SELECT ORDINAL_POSITION, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS =========================================== ===========================================

     1  dbo.SOH.SalesOrderID                         1   dbo.SOH.SalesOrderID
     2  dbo.SOH.RevisionNumber                       2   dbo.SOH.RevisionNumber
     3  dbo.SOH.OrderDate                            3   dbo.SOH.OrderDate
     4  dbo.SOH.DueDate                              4   dbo.SOH.DueDate
     5  dbo.SOH.ShipDate                             5   dbo.SOH.ShipDate
     6  dbo.SOH.Status                               6   dbo.SOH.Status
     8  dbo.SOH.SalesOrderNumber                     7   dbo.SOH.OnlineOrderFlag
    11  dbo.SOH.CustomerID                           8   dbo.SOH.SalesOrderNumber
    12  dbo.SOH.ShipToAddressID                      9   dbo.SOH.PurchaseOrderNumber
    13  dbo.SOH.BillToAddressID                      10  dbo.SOH.AccountNumber
    14  dbo.SOH.ShipMethod                           11  dbo.SOH.CustomerID
    15  dbo.SOH.CreditCardApprovalCode               12  dbo.SOH.ShipToAddressID
    16  dbo.SOH.SubTotal                             13  dbo.SOH.BillToAddressID
    17  dbo.SOH.TaxAmt                               14  dbo.SOH.ShipMethod
    18  dbo.SOH.Freight                              15  dbo.SOH.CreditCardApprovalCode
    19  dbo.SOH.TotalDue                             16  dbo.SOH.SubTotal
    20  dbo.SOH.Comment                              17  dbo.SOH.TaxAmt
    21  dbo.SOH.rowguid                              18  dbo.SOH.Freight
    22  dbo.SOH.ModifiedDate                         19  dbo.SOH.TotalDue
                                                     20  dbo.SOH.Comment
                                                     21  dbo.SOH.rowguid
                                                     22  dbo.SOH.ModifiedDate

If you see, columns at ordinal position 7, 9 and 10 are not being returned (and my guess is these are columns that were added via ALTER TABLE ddl after the table was created)

www-viveksharma commented 2 years ago

@tkyc , could you please check

www-viveksharma commented 2 years ago

From the comments it looks like the jdbc driver internally calls : EXEC sp_columns_100 and I tried running the following sp_columns 'SOH', 'dbo'; and indeed it does not return the 3 columns that DatabaseMetaData.getColumns() is missing

www-viveksharma commented 2 years ago

I came across an article : https://sqlblog.org/2020/09/21/please-dont-use-sys-sp_columns that kind of suggests that sp_columns procedure internally uses a view : sys.spt_columns_odbc_view

and this article talks about how to refresh a view using SP_REFRESHVIEW

Wondering if I should try to refresh the view sys.spt_columns_odbc_view

manticore-projects commented 7 months ago

Greetings! Unfortunately I am facing a very similar issue, when certain columns are not included in metaData.getColumns(..) (with ColumnNamePattern = null).

I can see those columns only when querying the table as SELECT * from dbo..tableName. Also, the rs.getInt(ORDINAL_POSITION) skips (e.g. starts with 4 only, missing the first 3 columns), please see below how the ordinal position skips a few numbers across the table.

Unfortunately I am in an ETL situation where I have read only access to a remote database and a few tables only. I can't execute any sys.* procedures or rebuild views. ~No INFORMATION_SCHEMA either.~

So what am I supposed to do please?

┌─────┬───────────────────────────┬───────────────┬────────┬───────────┬──────────┬─────────┐
│ #   │ name                      │ type          │ length │ precision │ nullable │ remarks │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│   4 │ LoanRefNo                 │ smallint      │      5 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│   7 │ SanctionedDate            │ smalldatetime │     16 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  11 │ ValueDate                 │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  12 │ NoOfDisbursements         │ smallint      │      5 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  14 │ FirstDisbursementDate     │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  17 │ LastDisbursementDate      │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  18 │ Term                      │ smallint      │      5 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  20 │ RepaymentTerm             │ smallint      │      5 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  23 │ AmortizeUsingR78          │ bit           │      1 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  27 │ GracePeriod               │ smallint      │      5 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  28 │ InstallmentStartDate      │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  29 │ MaturityDate              │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  32 │ AdjustedGraceDays         │ int           │     10 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  35 │ FundID                    │ nvarchar      │     10 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  37 │ FileNumber                │ nvarchar      │     50 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  38 │ LoanLevel                 │ tinyint       │      3 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  44 │ LastRescheduleDate        │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  45 │ NoOfReschedule            │ tinyint       │      3 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  49 │ ClosedDate                │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  50 │ Remarks                   │ nvarchar      │  1,000 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  52 │ PurposeCategoryID         │ nvarchar      │     25 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  53 │ IsUtilizationchecked      │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  54 │ UtilizationDate           │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  59 │ IsSamePurpose             │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  63 │ IntFreeGracePeriod        │ smallint      │      5 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  64 │ IsIntChargeInGracePeriod  │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  65 │ SanctionRemarks           │ nvarchar      │  1,000 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  74 │ CreatedOn                 │ smalldatetime │     16 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  76 │ ModifiedOn                │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  78 │ SupervisedOn              │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  79 │ UpdateCount               │ tinyint       │      3 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  80 │ LoanTransferDate          │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  81 │ InstallmentNextDate       │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  83 │ RepaymentPeriodID         │ nvarchar      │      6 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  84 │ IsAlignWithMeetingDay     │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  85 │ RiskCategoryID            │ nvarchar      │     10 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  89 │ NextDbIntRevisionDate     │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  90 │ LastDbIntRevisionDate     │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  93 │ NoOfArrearDays            │ smallint      │      5 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  94 │ ProcessDate               │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  95 │ ArrearPrevInstDueDate     │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  96 │ ArrearLatestInstDueDate   │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  97 │ IsEqChargeExists          │ bit           │      1 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  98 │ IsAccrualStop             │ bit           │      1 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│  99 │ AccrualStopDate           │ smalldatetime │     16 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 100 │ CBEnquiryRefNo            │ bigint        │     19 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 103 │ TemplateID                │ nvarchar      │     10 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 104 │ IsTemplateInterest        │ bit           │      1 │         0 │ NO       │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 109 │ IsRoundLastInstallment    │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 110 │ IsVarFirstInstallment     │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 111 │ CanCrossOverMonth         │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 112 │ IsTermExcludesGracePeriod │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 113 │ IsFlexibleGracePeriod     │ bit           │      1 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 114 │ HolidayHandlingTypeID     │ nvarchar      │     25 │         0 │ YES      │         │
├─────┼───────────────────────────┼───────────────┼────────┼───────────┼──────────┼─────────┤
│ 115 │ IsRepaymentHoliday        │ bit           │      1 │         0 │ YES      │         │
└─────┴───────────────────────────┴───────────────┴────────┴───────────┴──────────┴─────────┘
manticore-projects commented 7 months ago

Please re-open since it is definitely a valid issue.

manticore-projects commented 7 months ago

Correction, I actually CAN ready INFORMATION_SCHEMA.COLUMNS And it shows the missing columns:

SELECT
    , TABLE_NAME
    , COLUMN_NAME
    , ORDINAL_POSITION
    , COLUMN_DEFAULT
    , IS_NULLABLE
    , DATA_TYPE
    , CHARACTER_MAXIMUM_LENGTH
FROM xxxx.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N't_Loan';
┌──────────────┬────────────┬──────────────────────────┬──────────────────┬────────────────┬─────────────┬───────────────┬──────────────────────────┐
│ TABLE_SCHEMA │ TABLE_NAME │ COLUMN_NAME              │ ORDINAL_POSITION │ COLUMN_DEFAULT │ IS_NULLABLE │ DATA_TYPE     │ CHARACTER_MAXIMUM_LENGTH │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ OurBranchID              │                1 │                │ NO          │ nvarchar      │                        6 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ AccountID                │                2 │                │ NO          │ nvarchar      │                       20 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanSeries               │                3 │                │ NO          │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanRefNo                │                4 │                │ NO          │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ApplicationID            │                5 │                │ YES         │ nvarchar      │                       16 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SanctionBy               │                6 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SanctionedDate           │                7 │                │ NO          │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SanctionedAmount         │                8 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanAmount               │                9 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ BookedAmount             │               10 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ValueDate                │               11 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ NoOfDisbursements        │               12 │                │ YES         │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ DisbursementModeID       │               13 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ FirstDisbursementDate    │               14 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ DisbursedAmount          │               15 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ DisbursedBy              │               16 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LastDisbursementDate     │               17 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ Term                     │               18 │                │ NO          │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanPeriodID             │               19 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RepaymentTerm            │               20 │                │ NO          │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RepaymentFrequencyID     │               21 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ CalculationMethodID      │               22 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ AmortizeUsingR78         │               23 │                │ NO          │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InterestTypeID           │               24 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ MarkingRate              │               25 │                │ YES         │ numeric       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InterestRate             │               26 │                │ NO          │ numeric       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ GracePeriod              │               27 │                │ YES         │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InstallmentStartDate     │               28 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ MaturityDate             │               29 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InstallmentAmount        │               30 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LastInstallmentAmount    │               31 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ AdjustedGraceDays        │               32 │                │ NO          │ int           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RepaymentMethodID        │               33 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PurposeCodeID            │               34 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ FundID                   │               35 │                │ YES         │ nvarchar      │                       10 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ CreditOfficerID          │               36 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ FileNumber               │               37 │                │ YES         │ nvarchar      │                       50 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanLevel                │               38 │                │ YES         │ tinyint       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ NetCollateralValue       │               39 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ OutstandingPrincipal     │               40 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InterestAmount           │               41 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UnearnedInterest         │               42 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ HealthCodeID             │               43 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LastRescheduleDate       │               44 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ NoOfReschedule           │               45 │                │ YES         │ tinyint       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanStatusID             │               46 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanTypeID               │               47 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ClosedBy                 │               48 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ClosedDate               │               49 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ Remarks                  │               50 │                │ YES         │ nvarchar      │                    1,000 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ OutstandingInterest      │               51 │                │ NO          │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PurposeCategoryID        │               52 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsUtilizationchecked     │               53 │                │ YES         │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UtilizationDate          │               54 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UtilizationVerifiedBy    │               55 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UtilizationAmount        │               56 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UtilizationTypeID        │               57 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UtilizationRemarks       │               58 │                │ YES         │ nvarchar      │                      255 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsSamePurpose            │               59 │                │ YES         │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RepaymentStageID         │               60 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InstallmentOnID          │               61 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ScheduleOnID             │               62 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IntFreeGracePeriod       │               63 │                │ YES         │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsIntChargeInGracePeriod │               64 │                │ YES         │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SanctionRemarks          │               65 │                │ YES         │ nvarchar      │                    1,000 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyTypeID            │               66 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyCalcMethodID      │               67 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyDayCountBasisID   │               68 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyCalcComponentID   │               69 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ Penalty                  │               70 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyMinCharge         │               71 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ PenaltyRoundingID        │               72 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ CreatedBy                │               73 │                │ NO          │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ CreatedOn                │               74 │                │ NO          │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ModifiedBy               │               75 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ModifiedOn               │               76 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SupervisedBy             │               77 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ SupervisedOn             │               78 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ UpdateCount              │               79 │                │ NO          │ tinyint       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LoanTransferDate         │               80 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InstallmentNextDate      │               81 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ InterestWaiverAmount     │               82 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RepaymentPeriodID        │               83 │                │ YES         │ nvarchar      │                        6 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsAlignWithMeetingDay    │               84 │                │ YES         │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RiskCategoryID           │               85 │                │ YES         │ nvarchar      │                       10 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ BaseRate                 │               86 │                │ YES         │ numeric       │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RevisionFrequencyID      │               87 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ RevisionActionID         │               88 │                │ YES         │ nvarchar      │                       25 │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ NextDbIntRevisionDate    │               89 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ LastDbIntRevisionDate    │               90 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ODPrincipal              │               91 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ODInterest               │               92 │                │ YES         │ money         │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ NoOfArrearDays           │               93 │                │ YES         │ smallint      │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ProcessDate              │               94 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ArrearPrevInstDueDate    │               95 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ ArrearLatestInstDueDate  │               96 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsEqChargeExists         │               97 │                │ NO          │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ IsAccrualStop            │               98 │                │ NO          │ bit           │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ AccrualStopDate          │               99 │                │ YES         │ smalldatetime │                          │
├──────────────┼────────────┼──────────────────────────┼──────────────────┼────────────────┼─────────────┼───────────────┼──────────────────────────┤
│ dbo          │ t_Loan     │ CBEnquiryRefNo           │              100 │                │ YES         │ bigint        │                          │
└──────────────┴────────────┴──────────────────────────┴──────────────────┴────────────────┴─────────────┴───────────────┴──────────────────────────┘
manticore-projects commented 7 months ago

More information (with catalog xxxx being just a placeholder for the real name I don't want to disclose). The internal procedure also does not return those columns, so it is not directly an issue with the MetaData function:

EXEC sp_columns_100 't_Loan', 'dbo', 'xxxx', '%',2 ,3;
┌─────────────────┬─────────────┬────────────┬───────────────────────────┬───────────┬───────────────┬───────────┬────────┬───────┬───────┬──────────┬─────────┬────────────┬───────────────┬──────────────────┬───────────────────┬──────────────────┬─────────────┬──────────────┬──────────────────┬────────────────┬────────────────┬─────────────────────┬────────────────────┬───────────────────────────┬──────────────────────────────────────┬─────────────────────────────────────┬──────────────────────────────┬──────────────┐
│ TABLE_QUALIFIER │ TABLE_OWNER │ TABLE_NAME │ COLUMN_NAME               │ DATA_TYPE │ TYPE_NAME     │ PRECISION │ LENGTH │ SCALE │ RADIX │ NULLABLE │ REMARKS │ COLUMN_DEF │ SQL_DATA_TYPE │ SQL_DATETIME_SUB │ CHAR_OCTET_LENGTH │ ORDINAL_POSITION │ IS_NULLABLE │ SS_IS_SPARSE │ SS_IS_COLUMN_SET │ SS_IS_COMPUTED │ SS_IS_IDENTITY │ SS_UDT_CATALOG_NAME │ SS_UDT_SCHEMA_NAME │ SS_UDT_ASSEMBLY_TYPE_NAME │ SS_XML_SCHEMACOLLECTION_CATALOG_NAME │ SS_XML_SCHEMACOLLECTION_SCHEMA_NAME │ SS_XML_SCHEMACOLLECTION_NAME │ SS_DATA_TYPE │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LoanRefNo                 │         5 │ smallint      │         5 │      2 │     0 │    10 │        0 │         │            │             5 │                  │                   │                4 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           52 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ SanctionedDate            │        93 │ smalldatetime │        16 │     16 │     0 │       │        0 │         │            │             9 │                3 │                   │                7 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           58 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ValueDate                 │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               11 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ NoOfDisbursements         │         5 │ smallint      │         5 │      2 │     0 │    10 │        1 │         │            │             5 │                  │                   │               12 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ FirstDisbursementDate     │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               14 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LastDisbursementDate      │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               17 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ Term                      │         5 │ smallint      │         5 │      2 │     0 │    10 │        0 │         │            │             5 │                  │                   │               18 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           52 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ RepaymentTerm             │         5 │ smallint      │         5 │      2 │     0 │    10 │        0 │         │            │             5 │                  │                   │               20 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           52 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ AmortizeUsingR78          │        -7 │ bit           │         1 │      1 │       │       │        0 │         │            │            -7 │                  │                   │               23 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ GracePeriod               │         5 │ smallint      │         5 │      2 │     0 │    10 │        1 │         │            │             5 │                  │                   │               27 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ InstallmentStartDate      │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               28 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ MaturityDate              │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               29 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ AdjustedGraceDays         │         4 │ int           │        10 │      4 │     0 │    10 │        0 │         │            │             4 │                  │                   │               32 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           56 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ FundID                    │        -9 │ nvarchar      │        10 │     20 │       │       │        1 │         │            │            -9 │                  │                20 │               35 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ FileNumber                │        -9 │ nvarchar      │        50 │    100 │       │       │        1 │         │            │            -9 │                  │               100 │               37 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LoanLevel                 │        -6 │ tinyint       │         3 │      1 │     0 │    10 │        1 │         │            │            -6 │                  │                   │               38 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LastRescheduleDate        │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               44 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ NoOfReschedule            │        -6 │ tinyint       │         3 │      1 │     0 │    10 │        1 │         │            │            -6 │                  │                   │               45 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ClosedDate                │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               49 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ Remarks                   │        -9 │ nvarchar      │     1,000 │  2,000 │       │       │        1 │         │            │            -9 │                  │             2,000 │               50 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ PurposeCategoryID         │        -9 │ nvarchar      │        25 │     50 │       │       │        1 │         │            │            -9 │                  │                50 │               52 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsUtilizationchecked      │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │               53 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ UtilizationDate           │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               54 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsSamePurpose             │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │               59 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IntFreeGracePeriod        │         5 │ smallint      │         5 │      2 │     0 │    10 │        1 │         │            │             5 │                  │                   │               63 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsIntChargeInGracePeriod  │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │               64 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ SanctionRemarks           │        -9 │ nvarchar      │     1,000 │  2,000 │       │       │        1 │         │            │            -9 │                  │             2,000 │               65 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ CreatedOn                 │        93 │ smalldatetime │        16 │     16 │     0 │       │        0 │         │            │             9 │                3 │                   │               74 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           58 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ModifiedOn                │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               76 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ SupervisedOn              │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               78 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ UpdateCount               │        -6 │ tinyint       │         3 │      1 │     0 │    10 │        0 │         │            │            -6 │                  │                   │               79 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           48 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LoanTransferDate          │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               80 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ InstallmentNextDate       │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               81 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ RepaymentPeriodID         │        -9 │ nvarchar      │         6 │     12 │       │       │        1 │         │            │            -9 │                  │                12 │               83 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsAlignWithMeetingDay     │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │               84 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ RiskCategoryID            │        -9 │ nvarchar      │        10 │     20 │       │       │        1 │         │            │            -9 │                  │                20 │               85 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ NextDbIntRevisionDate     │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               89 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ LastDbIntRevisionDate     │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               90 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ NoOfArrearDays            │         5 │ smallint      │         5 │      2 │     0 │    10 │        1 │         │            │             5 │                  │                   │               93 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           38 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ProcessDate               │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               94 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ArrearPrevInstDueDate     │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               95 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ ArrearLatestInstDueDate   │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               96 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsEqChargeExists          │        -7 │ bit           │         1 │      1 │       │       │        0 │         │            │            -7 │                  │                   │               97 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsAccrualStop             │        -7 │ bit           │         1 │      1 │       │       │        0 │         │            │            -7 │                  │                   │               98 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ AccrualStopDate           │        93 │ smalldatetime │        16 │     16 │     0 │       │        1 │         │            │             9 │                3 │                   │               99 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          111 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ CBEnquiryRefNo            │        -5 │ bigint        │        19 │      8 │     0 │    10 │        1 │         │            │            -5 │                  │                   │              100 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │          108 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ TemplateID                │        -9 │ nvarchar      │        10 │     20 │       │       │        1 │         │            │            -9 │                  │                20 │              103 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsTemplateInterest        │        -7 │ bit           │         1 │      1 │       │       │        0 │         │            │            -7 │                  │                   │              104 │ NO          │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsRoundLastInstallment    │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              109 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsVarFirstInstallment     │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              110 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ CanCrossOverMonth         │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              111 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsTermExcludesGracePeriod │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              112 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsFlexibleGracePeriod     │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              113 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ HolidayHandlingTypeID     │        -9 │ nvarchar      │        25 │     50 │       │       │        1 │         │            │            -9 │                  │                50 │              114 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           39 │
├─────────────────┼─────────────┼────────────┼───────────────────────────┼───────────┼───────────────┼───────────┼────────┼───────┼───────┼──────────┼─────────┼────────────┼───────────────┼──────────────────┼───────────────────┼──────────────────┼─────────────┼──────────────┼──────────────────┼────────────────┼────────────────┼─────────────────────┼────────────────────┼───────────────────────────┼──────────────────────────────────────┼─────────────────────────────────────┼──────────────────────────────┼──────────────┤
│ xxxxxxxx        │ dbo         │ t_Loan     │ IsRepaymentHoliday        │        -7 │ bit           │         1 │      1 │       │       │        1 │         │            │            -7 │                  │                   │              115 │ YES         │            0 │                0 │              0 │              0 │                     │                    │                           │                                      │                                     │                              │           50 │
└─────────────────┴─────────────┴────────────┴───────────────────────────┴───────────┴───────────────┴───────────┴────────┴───────┴───────┴──────────┴─────────┴────────────┴───────────────┴──────────────────┴───────────────────┴──────────────────┴─────────────┴──────────────┴──────────────────┴────────────────┴────────────────┴─────────────────────┴────────────────────┴───────────────────────────┴──────────────────────────────────────┴─────────────────────────────────────┴──────────────────────────────┴──────────────┘
manticore-projects commented 7 months ago

More info:

-- all the same output, all skipping columns
EXEC sp_columns_100 't_Loan', null, null, null,2 ,3;
EXEC sp_columns_100 't_Loan', `dbo`, null, null,2 ,3;
EXEC sp_columns_100 't_Loan', `dbo`, `xxxxx`, `%`,2 ,3;

-- returns all columns correctly, see below
SELECT *
  FROM sys.columns
  WHERE [object_id] = OBJECT_ID('dbo.t_Loan');

So it all boils down to calling sp_columns_100 and probably sys.columns should be used instead. Would you like to accept a PR?

┌───────────────┬──────────────────┬───────────┬────────────────┬──────────────┬────────────┬───────────┬───────┬──────────────────────────────┬─────────────┬────────────────┬───────────────┬─────────────┬─────────────┬───────────────┬───────────────┬───────────────────────┬────────────────────┬───────────────────┬─────────────────┬───────────────────┬───────────────────┬────────────────┬───────────┬───────────────┬───────────────────────┬────────────────────────────┬─────────────────┬──────────────────────┬───────────────────────────┬──────────────────────────┬─────────────────────────────────────┬───────────┬───────────┐
│ object_id     │ name             │ column_id │ system_type_id │ user_type_id │ max_length │ precision │ scale │ collation_name               │ is_nullable │ is_ansi_padded │ is_rowguidcol │ is_identity │ is_computed │ is_filestream │ is_replicated │ is_non_sql_subscribed │ is_merge_published │ is_dts_replicated │ is_xml_document │ xml_collection_id │ default_object_id │ rule_object_id │ is_sparse │ is_column_set │ generated_always_type │ generated_always_type_desc │ encryption_type │ encryption_type_desc │ encryption_algorithm_name │ column_encryption_key_id │ column_encryption_key_database_name │ is_hidden │ is_masked │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ OurBranchID      │         1 │            231 │          264 │         12 │         0 │     0 │ SQL_Latin1_General_CP1_CI_AS │ false       │ true           │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ AccountID        │         2 │            231 │          257 │         40 │         0 │     0 │ SQL_Latin1_General_CP1_CI_AS │ false       │ true           │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ LoanSeries       │         3 │             52 │          258 │          2 │         5 │     0 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ LoanRefNo        │         4 │             52 │           52 │          2 │         5 │     0 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ ApplicationID    │         5 │            231 │          262 │         32 │         0 │     0 │ SQL_Latin1_General_CP1_CI_AS │ true        │ true           │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ SanctionBy       │         6 │            231 │          276 │         50 │         0 │     0 │ SQL_Latin1_General_CP1_CI_AS │ false       │ true           │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ SanctionedDate   │         7 │             58 │           58 │          4 │        16 │     0 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ SanctionedAmount │         8 │             60 │          260 │          8 │        19 │     4 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │                 0 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ LoanAmount       │         9 │             60 │          260 │          8 │        19 │     4 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │     1,819,205,581 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
├───────────────┼──────────────────┼───────────┼────────────────┼──────────────┼────────────┼───────────┼───────┼──────────────────────────────┼─────────────┼────────────────┼───────────────┼─────────────┼─────────────┼───────────────┼───────────────┼───────────────────────┼────────────────────┼───────────────────┼─────────────────┼───────────────────┼───────────────────┼────────────────┼───────────┼───────────────┼───────────────────────┼────────────────────────────┼─────────────────┼──────────────────────┼───────────────────────────┼──────────────────────────┼─────────────────────────────────────┼───────────┼───────────┤
│ 1,019,150,676 │ BookedAmount     │        10 │             60 │          260 │          8 │        19 │     4 │                              │ false       │ false          │ false         │ false       │ false       │ false         │ false         │ false                 │ false              │ false             │ false           │                 0 │     1,835,205,638 │              0 │ false     │ false         │                     0 │ NOT_APPLICABLE             │                 │                      │                           │                          │                                     │ false     │ false     │
└───────────────┴──────────────────┴───────────┴────────────────┴──────────────┴────────────┴───────────┴───────┴──────────────────────────────┴─────────────┴────────────────┴───────────────┴─────────────┴─────────────┴───────────────┴───────────────┴───────────────────────┴────────────────────┴───────────────────┴─────────────────┴───────────────────┴───────────────────┴────────────────┴───────────┴───────────────┴───────────────────────┴────────────────────────────┴─────────────────┴──────────────────────┴───────────────────────────┴──────────────────────────┴─────────────────────────────────────┴───────────┴───────────┘
...