mssql在javascript('dbo.index')中从SQL Server读取特定表时出现问题

mssql在javascript('dbo.index')中从SQL Server读取特定表时出现问题,javascript,node.js,sql-server,express,node-mssql,Javascript,Node.js,Sql Server,Express,Node Mssql,我必须在我的node js express应用程序中从SQL Server读取一个名为dbo.Index的表,但它失败了,并且没有返回任何内容 这是我的密码: app.get('/getData', (req, res, next) => { const config = { user: 'sa', password: '12345', server: 'localhost', database: 'myDB'

我必须在我的node js express应用程序中从SQL Server读取一个名为dbo.Index的表,但它失败了,并且没有返回任何内容

这是我的密码:

app.get('/getData',  (req, res, next) => {
    const config = {
        user: 'sa',
        password: '12345',
        server: 'localhost',
        database: 'myDB'
    }
    const pool = new sql.ConnectionPool(config)

    pool.connect(err => {
        if (err) console.log(err)
        console.log('connected.')

        const request = new sql.Request(pool)
        request.query(`SELECT * FROM dbo.Index`, (error, recordSet) => {
            if (err) console.log(error)
            res.send(recordSet)
        })
    })

})
我已经测试了这段代码,它可以很好地与其他表一起使用,但是使用这个特定的名称dbo.Index,它失败了

我必须阅读它,没有权限我不能更改表名

我使用节点mssql包来连接数据库。

索引是一个,因此您需要将其用方括号括起来,如下所示:

SELECT * FROM [dbo].[Index]
通常,最好尽量避免在表名或列名中使用保留字,因为这很容易导致混淆、错误和bug