Answer the question
In order to leave comments, you need to log in
SQL server + yii2 api, problem when writing to the database, swears at SET EDINTITY OFF?
Hello everyone, the problem is when writing explicit id values to the mssql server database, in particular, it swears at SET IDENTITY_INSERT users OFF
In fact, we write id from one database through the YII2 API to sql server, but we get an error.
In the migration, when creating the USERS table, we specified the conditions
if ($this->db->driverName === 'sqlsrv') {
$this->execute('SET IDENTITY_INSERT DataExchange.dbo.users ON');
}
Answer the question
In order to leave comments, you need to log in
If you are wrapping data in DataExchange.dbo.users
, then disable id
the identifier specification IDENTITY
altogether.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question