Skip to content
Advertisement

Laravel 8.54.0 + Livewire : Error SQLSTATE[IMSSP] Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters

I use Laravel Framework 8.54.0 and livewire. I want to call data for my dropdown form. But I get sqlstate error. Could anyone help me find a way to solve this issue?

Model:

class Item extends Model
{
    protected $table = 'item';
    protected $primaryKey = 'idx';
    public $timestamps = false;
    public const CREATED_AT = 'd_in';
    public const UPDATED_AT = 'd_edit';
    protected $connection = 'mysql2';
}

Livewire Controller:

$this->produk_ictn_row = Item::get();

View:

<select disabled name="formkodeproduk" id="formkodeproduk" class="form-control @error('formkodeproduk') is-invalid @enderror" wire:model="produk_code">
@foreach($produk_ictn_row as $produk_ictn_row)
    <option value="{{$produk_ictn_row->Kode}}">{{$produk_ictn_row->Kode}}</option>
@endforeach
</select>

enter image description here

Advertisement

Answer

it says you have more than 2100 records so the query should contain all of them in where query!!

Well in some sql serves like microsoft-sql the limit in sql parameter is 2100 , so you have 2 options:

first you can split your query to prevent this error… second you can split your table and do some parallel queries.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement