SupunSam
3 months ago
549
2
Laravel

MS SQL error when running a Laravel Seeder

Posted 3 months ago by SupunSam

I recently changed my db from mysql to SQL Server.

I was able to run the migrations however I am unable to run Seeders.

Illuminate\Database\QueryException  : SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'. (SQL: describe profiles)

  at C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
  > 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
    669| 

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'.")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  2   PDOStatement::execute()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  Please use the argument -v to see more details.

Seeder

$superadminRole = Role::where('name', 'superadmin')->first();
        $adminRole = Role::where('name', 'admin')->first();
        $leadRole = Role::where('name', 'lead')->first();
        $userRole = Role::where('name', 'user')->first();

        $superadmin = User::create([
            'id' => '232323',
            'username' => 'SuperAdmin',
            'site' => 'GSS',
            'password' => bcrypt('superadmin')
        ]);

        $superadmin->roles()->attach($superadminRole);
        $superadmin->roles()->attach($adminRole);
        $superadmin->roles()->attach($leadRole);
        $superadmin->roles()->attach($userRole);

        $user->roles()->attach($userRole);

Can anyone help me ?

Please sign in or create an account to participate in this conversation.