0

我在带有用于 sql server 的 MSSQL 驱动程序的 Node JS 中有这个查询:

public getDataParameterFirst(SerialNumber, Sid, OreDa, OreA, MinutiDa, MinutiA)
{

    return runDb(cnn => cnn.query `SELECT * FROM activeTelemetry.tbl_EHStage WHERE SerialNumber = ${SerialNumber} AND Sid = ${Sid}
                                                    AND Day = DATEPART(day, getutcdate()) AND Month = DATEPART(month, getutcdate()) 
                                                    AND Year = DATEPART(year, getutcdate()) AND Hour >= ${OreDa} AND Hour < ${OreA} AND Minute >= ${MinutiA} AND Minute < ${MinutiDa}`
        .then( result => { console.dir(result); return result.recordset})

    );
}

查询返回:

 { recordsets: [ [] ],
 recordset: [],
 output: {},
 rowsAffected: [ 0 ] }

如果删除

AND Minute >= ${MinutiA} AND Minute < ${MinutiDa}

查询有效。

有人能帮我吗?

4

0 回答 0