@marttyn It seems the error you are getting it's for soft deletion.
Just to double confirm, the soft delete column is nullable in the users migration file. For example:
$table->softDeletes();
``
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I'm using Laravel 9, PHP 8.0 and SQL Server. I'm trying to update a user but I'm getting the following exception.
SQLSTATE[22007]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Conversion failed when converting date and/or time from character string.
The query running is:
select
count(*) as aggregate
from
[users]
where
[email] = user_email
and [id] <> user_id
and [deleted_at] = null
Where user_email and user_id are the email and id of the user being updated.
This isn't a query that I wrote so I'm assuming that is internal to Laravel. I know that the issue is because the query has wrong syntax, it should be "[deleted_at] IS NULL" instead of "= NULL", but as this is an internal query I don't know how to fix it.
You can exclude trashed models;
'email' => [
'required',
'string',
'max:255',
Rule::unique('users')
->ignore($this->id)
->where(fn (Builder $query) => $query->whereNull('deleted_at' ))
],
Please or to participate in this conversation.