2

I have created new database and new schema.

CREATE DATABASE banks_db;

CREATE SCHEMA Chains;

Database was created, but not schema, and when I try to create it one more time I get error:

SQL Error [2714] [S0001]: There is already an object named 'Chains' in the database.

And as you can see on screen (even after refresh), there is no my schema.

enter image description here

So, how can I create new schema?

2
  • 1
    If you want to create the schema in the banks_db database, you probably need to use banks_db first...
    – mustaccio
    Nov 3, 2021 at 18:29
  • 1
    Doesn't work, but this should work even without this use
    – dokichan
    Nov 3, 2021 at 19:39

2 Answers 2

1

You can edit the connection and tick "Show All Schemas" otherwise you will only see dbo Edit Connection

0

This batch

CREATE DATABASE banks_db;

CREATE SCHEMA Chains

will create Chains in the current database, not banks_db. Try something like:

CREATE DATABASE banks_db;
go
use banks_db;
go
CREATE SCHEMA Chains;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.