Laravel 5.3 sqlsrv和attach()到数据透视表

My setup is Laravel 5.3.29 running on Windows. Database is SqlServer 2012.

I have 2 models, Document with primary key id and these 3 methods:

// Each doc needs to link to the older version of itself and the newer version too.
public function parent() {
    return $this->belongsToOne(static::class, 'prevId');
}

//each category might have multiple children
public function children() {
    return $this->hasMany(static::class, 'prevId');
}


public function tags()
{
    return $this->belongsToMany('App\Models\Tag');
}

and model Tag with primary key id and:

function documents()
{
    return $this->belongsToMany('App\Models\Document');
}

there is a pivot table document_tag

and the store method on the DocumentController contains:

    ...
    $document->save();

    $tags = explode(',', $this->tags);         // coma seperated list of tag id's

    if($this->tags) {
        foreach($tags as $tag) {
            $document->tags ()->attach ($tag);
        }
    }

I migrated data from an existing system and when I get to 2101 document I get the error below. If I comment out the attach() block then everything runs smoothly but of course without any tags being associated to documents.

Next Illuminate\Database\QueryException: SQLSTATE[IMSSP]: Tried to bind parameter number 2101.  SQL Server supports a maximum of 2100 parameters. (SQL:
select [tags].*,
       [document_tag].[document_id] as [pivot_document_id],
       [document_tag].[tag_id] as [pivot_tag_id]
  from [tags] inner join [document_tag] on [tags].[id] = [document_tag].[tag_id]
 where [document_tag].[document_id] in (1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, ...removed a couple of thousand id's... 7866))

Does anyone have any ideas or can anyone point me in the right direction to solve this please?