Is there a way to use `skipDuplicates` with SQL Se...
# orm-help
y
Is there a way to use
skipDuplicates
with SQL Server?
n
Hey Yaakov 👋 Are you referring to
skipDuplicates
in createMany function?
y
@Nurul Yes
n
Are you facing any errors while using
skipDuplicates
with
createMany
?
y
Copy code
Error:
Invalid `prisma.criticalPaymentTask.createMany()` invocation in
/usr/src/app/routes/criticalPaymentTasks.js:257:36

  254
  255 console.log(newOccurrences);
  256
→ 257 await prisma.criticalPaymentTask.createMany({
     skipDuplicates: true,
     ~~~~~~~~~~~~~~
     data: []
   })

Unknown arg `skipDuplicates` in skipDuplicates for type AffectedRowsOutput. Did you mean `select`? Available args:
type createManyCriticalPaymentTask {
  data: List<CriticalPaymentTaskCreateManyInput>
}
@Nurul See error ⬆️
The `Did you mean
select
?` makes no sense because
createMany
does not have a
select
.
n
Can you please share your schema file or
criticalPaymentTask
model? What version of prisma are you using? I would like to replicate this issue on my end to check what’s going wrong.
y
Copy code
model CriticalPaymentTask {
  id                    Int       @id @default(autoincrement())
  projection_id         Int
  expected_payment_date DateTime  @db.Date
  estimated_amount      BigInt
  amount_paid           BigInt    @default(0)
  note                  String?
  account_number        String?
  auto_pay              Boolean   @default(false)

  // Many-to-one relations
  projection CriticalPaymentProjection @relation(fields: [projection_id], references: [id])

  @@unique([projection_id, expected_payment_date])
  @@map("critical_payment_tasks")
}
Copy code
generator client {
  provider        = "prisma-client-js"
  binaryTargets   = ["native", "linux-musl"]
  previewFeatures = ["interactiveTransactions"]
}

datasource db {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}
@Nurul I'm on the latest version of Prisma
n
Thank you for sharing, I’ll try to replicate this on my end. Meanwhile, could you create a Bug Report? Our engineering team is monitoring that and in case there is some known issue they should be able to help out.
y
Thank you. But are you sure that this feature is meant to work for SQL Server? The docs state "Only supported by databases that support
ON CONFLICT DO NOTHING
." I'm not sure if SQL Server is included... https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#createmany
👍 1
n
That’s true, that might be the case because I searched in SQL server docs and couldn’t find anything related to the
DO NOTHING
clause.
y
I guess that will have to be my assumption as well 😄
😃 1