1

I use sql server 2014 and with following piece of code:

if db_id('handel') is not null
    drop database handel;

create database handel;
use handel;

I get the error: Database 'handel' does not exist. Make sure that the name is entered correctly. on line use handel, which blows my mind a bit, as just a line before I create said database. Could anyone please help?

1 Answer 1

6

You missed GO Keyword:

if db_id('handel') is not null
    drop database handel;

create database handel;
GO
use handel;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.