func setIdentityInsert(scope *gorm.Scope) { if scope.Dialect().GetName() == "mssql" { scope.NewDB().Exec(fmt.Sprintf("SET IDENTITY_INSERT %v ON", scope.TableName())) } }