Chip Clark
09/24/2021, 3:49 PM102
. Message: Incorrect syntax near '='.
If I change last line to WHERE contcomp.ContactCompanyID = 7247
error: Raw query failed. Code: 102
. Message: Incorrect syntax near '.'.
This suggests the query is not able to process the field name ContactCompanyID for WHERE.Chip Clark
09/24/2021, 3:50 PMChip Clark
09/24/2021, 4:10 PM$queryRaw
is a tag function, please use it like the following:
```
const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`Chip Clark
09/24/2021, 4:12 PMWHERE ContactCompanyID = ${companyID}
Same error $queryRaw is a tag function...Chip Clark
09/24/2021, 9:48 PMChip Clark
09/24/2021, 9:50 PM$queryRaw
is a tag function, please use it like the following:
const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
The variable rawView =
SELECT contcomp.ContactCompanyID [ContactCompanyID], contcomp.CompanyName [CompanyName],
contcomp.CompanyWebSite FROM dbo.ContactCompany AS contcomp WHERE contcomp.ContactCompanyID = 7247
This works on the sql server, but not using queryRaw