node-mssql icon indicating copy to clipboard operation
node-mssql copied to clipboard

How to use the user-defined data types?

Open jhunexjun opened this issue 1 year ago • 0 comments

Can this package supports user-defined data types?

Expected behaviour:

just normal as built-in types like NVARCHAR, VARCHAR, etc.

Actual behaviour:

TypeError: Cannot read properties of undefined (reading 'type')

Configuration:

return await msSqlConnect.getInstance().then(pool => {
        return pool.request()
          .input('userId', msSql.T_USR_ID, req.query.userId)
          .query('select * from SY_USR where USR_ID = @userId')
      }).then(result => {
        console.log('result: ', result);
        return result.recordset;
      }).catch(err => {
        console.log(err);
      });

The T_USR_ID is a user-defined data type.

Software versions

  • NodeJS: v16.13.0
  • node-mssql: "mssql": "^9.1.1",
  • SQL Server: Microsoft SQL Server 2019 (RTM-GDR) (KB5029377) - 15.0.2104.1 (X64) Aug 16 2023 00:09:21 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 22621: ) (Hypervisor)

jhunexjun avatar Feb 20 '24 23:02 jhunexjun